Reloading public files on Amber.
You need Crystal and Amber::CMD installed
class ListenersController < ApplicationController | |
def paypal_ipn | |
raw_post = request.raw_post | |
notification = ActiveMerchant::Billing::Integrations::Paypal::Notification.new(raw_post) | |
@ipn_log = PaypalIpnLog.new(:raw_post => raw_post) | |
if development? || notification.acknowledge | |
recurring_payment_id = notification.params['recurring_payment_id'] | |
@ipn_log.recurring_payment_id = recurring_payment_id |
class UserRenameAvatarToProfileRemoveAAddB < ActiveRecord::Migration | |
# you may want to change these | |
AttachmentColumns = [["file_name", :string], ["content_type", :string], ["file_size", :integer]] | |
# make sure this matches your setup, also have a look in the rename and remove methods | |
AttachmentPath = Rails.root.join("public", "system") | |
def self.rename_attachment(table, old, new) | |
AttachmentColumns.each do |suffix, type| | |
rename_column table, "#{old}_#{suffix}", "#{new}_#{suffix}" | |
end |
import List (..) | |
import Random (..) | |
import Text (asText) | |
shuffle : List a -> List a | |
shuffle lt = | |
let len = length lt | |
fgen = float 0 1 | |
lgen = list len fgen | |
rlist = fst <| generate lgen (initialSeed 31415) |
class ConvertImagesToPaperclip < ActiveRecord::Migration | |
include PaperclipMigrations | |
def self.up | |
# Paperclip | |
add_column :images, :data_file_name, :string | |
add_column :images, :data_content_type, :string | |
add_column :images, :data_file_size, :integer | |
add_column :images, :data_updated_at, :datetime |
class ProgressBar | |
def initialize(units=60) | |
@units = units.to_f | |
end | |
def print(completed, total) | |
norm = 1.0 / (total / @units) | |
progress = (completed * norm).ceil | |
pending = @units - progress | |
Kernel.print "[#{'=' * progress }#{' ' * ( pending )}] #{percentage(completed, total)}%\r" |
# Elixir v1.0.2 | |
defmodule Prime do | |
def stream do | |
Stream.unfold( [], fn primes -> | |
next = next_prime(primes) | |
{ next, [next | primes] } | |
end ) | |
end |
(evil-define-operator evil-delete-char-without-register (beg end type reg) | |
"delete character without yanking unless in visual mode" | |
:motion evil-forward-char | |
(interactive "<R><y>") | |
(if (evil-visual-state-p) | |
(evil-delete beg end type reg) | |
(evil-delete beg end type ?_))) | |
(evil-define-operator evil-delete-backward-char-without-register (beg end type reg) | |
"delete backward character without yanking" |
a = {1, 0} | |
b = {a, a} | |
c = {b, b} | |
d = {c, c} | |
e = {d, d} | |
f = {e, e} | |
g = {f, f} | |
h = {g, g} | |
i = {h, h} | |
j = {i, i} |
#!/usr/bin/env ruby | |
# | |
# Proof-of-Concept exploit for Rails SQL Injection (CVE-2013-0156) | |
# | |
# ## Advisory | |
# | |
# https://groups.google.com/forum/#!topic/rubyonrails-security/61bkgvnSGTQ/discussion | |
# | |
# ## Caveats | |
# |