class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_action :authenticate_user!
end
<h1><%= @post.title %></h1>
<p><%= @post.author_name %></p>
<%# Only sanitized rich text should be rendered as HTML %>
<div class="prose"><%= sanitize(@post.body_html, tags: %w[p a ul ol li strong em code], attributes: %w[href]) %></div>
# Vulnerable: user input is concatenated directly into SQL.
email = params[:email]
password = params[:password]
sql = "SELECT * FROM users WHERE email = '#{email}' AND password_hash = '#{password}'"
user = ActiveRecord::Base.connection.execute(sql).first
import cv2
image = cv2.imread('receipt.jpg')
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
blurred = cv2.GaussianBlur(gray, (5, 5), 0)
thresholded = cv2.adaptiveThreshold(
import geopandas as gpd
from shapely.geometry import Point
stores = gpd.read_file('stores.geojson').to_crs(epsg=3857)
customers = gpd.GeoDataFrame(
customer_df,
import re
text = 'INC-102301 resolved on 2026-04-06 after payment failure for order ORD-99182.'
patterns = {
'incident_id': r'INC-[0-9]{6}',
import time
import requests
from bs4 import BeautifulSoup
session = requests.Session()
session.headers.update({'User-Agent': 'research-bot/1.0'})
WITH ordered_events AS (
SELECT
customer_id,
event_time,
revenue,
ROW_NUMBER() OVER (PARTITION BY customer_id ORDER BY event_time DESC) AS event_rank,
import great_expectations as gx
context = gx.get_context()
data_source = context.data_sources.add_pandas(name='training_data')
asset = data_source.add_dataframe_asset(name='churn_asset')
batch_definition = asset.add_batch_definition_whole_dataframe('full_dataframe')
import pandera as pa
from pandera.typing import Series
class ChurnTrainingSchema(pa.DataFrameModel):
customer_id: Series[int] = pa.Field(unique=True)
age: Series[int] = pa.Field(ge=18, le=100)
import mlflow
import mlflow.sklearn
from sklearn.metrics import roc_auc_score
mlflow.set_experiment('customer-churn')
import joblib
from skl2onnx import to_onnx
from skl2onnx.common.data_types import FloatTensorType
joblib.dump(model, 'artifacts/model.joblib')