Skip to content

Instantly share code, notes, and snippets.

View enoliglesias's full-sized avatar

Enol Iglesias enoliglesias

View GitHub Profile
@enoliglesias
enoliglesias / sermepa_signature_sha256_confirmation.rb
Last active November 25, 2016 17:35
Ds_Signature creation for Sermepa with SHA256
def confirmation(credentials)
return false if params['ds_signature'].blank?
# The DES3-CBC key generation it's the same that in the creation gist
# You can take a look at the explanation
secret_key = credentials[:secret_key]
secret_key_base64 = Base64.strict_decode64(secret_key)
des3 = OpenSSL::Cipher::Cipher.new('des-ede3-cbc')
block_length = 8
des3.padding = 0
@enoliglesias
enoliglesias / tmux-cheatsheet.markdown
Created February 24, 2016 15:16 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
<?xml version="1.0" encoding="UTF-8"?>
<yahoo-weather-codes>
<code number="0" description="tornado"/>
<code number="1" description="tropical storm"/>
<code number="2" description="hurricane"/>
<code number="3" description="severe thunderstorms"/>
<code number="4" description="thunderstorms"/>
<code number="5" description="mixed rain and snow"/>
<code number="6" description="mixed rain and sleet"/>
<code number="7" description="mixed snow and sleet"/>
@enoliglesias
enoliglesias / time_machine.rb
Last active March 8, 2016 19:32
Rack middleware to travel in time your rails application
class Dummy::TimeMachine
def initialize(app)
@app = app
end
def call(env)
Rails.logger.info("[TimeMachine] Starting time travel.")
Timecop.return
request = Rack::Request.new(env)
params = request.params
@enoliglesias
enoliglesias / js_module_closure.js
Created March 17, 2016 15:31 — forked from carloscabo/js_module_closure.js
JS Module with closure
;(function($, undefined) {
'use strict';
if (typeof window.MY_MODULE_NAME !== 'undefined') {
return;
}
//
// Module general vars
//
@enoliglesias
enoliglesias / character_set_and_collation.rb
Created June 23, 2016 13:30 — forked from tjh/character_set_and_collation.rb
Convert all Rails table column collation and character set
#!/usr/bin/env ruby
# Put this file in the root of your Rails project,
# then run it to output the SQL needed to change all
# your tables and columns to the same character set
# and collation.
#
# > ruby character_set_and_collation.rb
DATABASE = ''
@enoliglesias
enoliglesias / config.ru
Last active April 19, 2017 17:56
Some examples for my "Rack basics" slides :)
class Wadus
def call(env)
['200', {'X-Wadus' => 'Foo'}, ['Rack app with config.ru file']]
end
end
run Wadus.new