Skip to content

Instantly share code, notes, and snippets.

Never asked for this.

Paweł Gościcki pjg

Never asked for this.
View GitHub Profile
View uploads_controller.rb
class Api::UploadsController < ApiController
def create
@upload =
pjg / webhooks_controller.rb
Created Feb 4, 2021 — forked from joost/webhooks_controller.rb
Mandrill API Webhook signature verification. This shows how you could verify a Mandrill signature in a Rails Controller.
View webhooks_controller.rb
class WebhooksController < ActionController::Base
WEBHOOK_KEY = "some_key" # You could also use an API request to lookup the key
before_filter :verify_request_signature
# See:
def verify_request_signature
signed_data = request.url
post_params = request.request_parameters.dup # POST parameters
pjg / youtubeID.js
Created Aug 5, 2019 — forked from takien/youtubeID.js
Get YouTube ID from various YouTube URL using JavaScript
View youtubeID.js
* Get YouTube ID from various YouTube URL
* @author: takien
* @url:
* For PHP YouTube parser, go here
function YouTubeGetID(url){
var ID = '';
url = url.replace(/(>|<)/gi,'').split(/(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)/);
pjg / exercise.rb
Last active Nov 22, 2018
View exercise.rb
require 'rspec'
class Array
def pairs(sum)
# arr = [1,3,4,5,2,6,-1,0,2]
# p arr.pairs(4) # => [[1,3],[4,0],[5,-1],[2,2]]
pjg / rom-mapper.rb
Last active Oct 6, 2017
rom-mapper problem with reverse relationship
View rom-mapper.rb
require 'rom-mapper'
class BigDecimal
def inspect
format("#<BigDecimal:%x %s>", object_id, to_s('F'))
class Gateway
def get_authors

In Rails 3

If you add a dir directly under app/

Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.

If you add a dir under app/something/

(e.g. app/models/concerns/, app/models/products/)

View big_decimal_inspect.rb
class BigDecimal
def inspect
format("#<BigDecimal:%x %s>", object_id, to_s('F'))
View projections.json
"app/assets/javascripts/models/*.coffee": {
"command": "jmodel",
"alternate": "spec/javascripts/models/",
"template": "App.%S = DS.Model.extend"
"app/assets/javascripts/controllers/*": {
"command": "jcontroller",
"alternate": "spec/javascripts/controllers/",
pjg / gist:4619601
Created Jan 24, 2013
My vim version
View gist:4619601
☺ vim --version 11:16
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Oct 26 2012 16:45:32)
Included patches: 1-547
Modified by
Compiled by buildd@
Huge version with GTK2-GNOME GUI. Features included (+) or not (-):
+arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset +cindent
+clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
+conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con_gui +diff
pjg / lyrics.txt
Created Apr 22, 2012
Piano Man by Johnny Diggz @ Railsberry
View lyrics.txt
It's 8:00 o'clock on a Friday
The regular crowd shuffles in
there's an old man sitting next to me
making love to his beer
la la di di da
la la di di da
Sing us a song, you're the piano man!
sing us a song tonight