Skip to content

Instantly share code, notes, and snippets.

Enol Iglesias enoliglesias

Block or report user

Report or block enoliglesias

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@enoliglesias
enoliglesias / config.ru
Last active Apr 19, 2017
Some examples for my "Rack basics" slides :)
View config.ru
class Wadus
def call(env)
['200', {'X-Wadus' => 'Foo'}, ['Rack app with config.ru file']]
end
end
run Wadus.new
@enoliglesias
enoliglesias / character_set_and_collation.rb
Created Jun 23, 2016 — forked from tjh/character_set_and_collation.rb
Convert all Rails table column collation and character set
View character_set_and_collation.rb
#!/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 = ''
View js_module_closure.js
;(function($, undefined) {
'use strict';
if (typeof window.MY_MODULE_NAME !== 'undefined') {
return;
}
//
// Module general vars
//
@enoliglesias
enoliglesias / time_machine.rb
Last active Mar 8, 2016
Rack middleware to travel in time your rails application
View time_machine.rb
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
View yahoo-weather-condition-codes.xml
<?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"/>
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@enoliglesias
enoliglesias / sermepa_signature_sha256_confirmation.rb
Last active Nov 25, 2016
Ds_Signature creation for Sermepa with SHA256
View sermepa_signature_sha256_confirmation.rb
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
You can’t perform that action at this time.