Skip to content

Instantly share code, notes, and snippets.

@orendon
orendon / script.js
Last active May 20, 2016 17:55 — forked from camilonova/script.js
Utilizando la sucursal virtual de bancolombia es frustrante tener que escribir la clave con el teclado virtual y ver esa alerta del navegador. Pega el contenido de este script en la consola del navegador para que puedas escribir la clave con el teclado. Ver en acción: http://giphy.com/gifs/l0K4hGF22s2AojfAA
function blockEnter(evt) {return true;}
function validarNoUsarTecladoReal_OnKeyPress(_object){return false;}
codigo = " p 'hello world' "
pp Ripper.lex(codigo) # Paso 1, Tokenizacion
# [[[1, 0], :on_sp, " "],
# [[1, 1], :on_ident, "p"],
# [[1, 2], :on_sp, " "],
# [[1, 3], :on_tstring_beg, "'"],
# [[1, 4], :on_tstring_content, "hello world"],
# [[1, 15], :on_tstring_end, "'"],
@orendon
orendon / gist:f59240ca7e3191cb7846
Created March 16, 2016 22:14 — forked from husobee/gist:9ff87a6f27e9abb4a3bc
Example of Mocking in Golang, and Monkey Patch
package main
import "fmt"
type Something struct {}
func (s Something) Test() bool {
return false
}
type SomethingInterface interface {
@orendon
orendon / Readme.md
Created February 6, 2016 13:30 — forked from Evangenieur/Readme.md
Ruby Server / Node.js Benchmark

Sinatra

ruby 1.9.2 + async_sinatra + thin thin start

ab -n 10000 -c 100 http://localhost:3000/
-> 49ms / request

Node

node server.js
@orendon
orendon / uploads_controller.rb
Last active November 28, 2022 06:33 — forked from longlostnick/uploads_controller.rb
Rails JSON file upload with carrierwave (from base64 string)
class Api::UploadsController < ApiController
def create
@upload = Upload.new(upload_params)
ensure
clean_tempfile
end
private
@orendon
orendon / without_foreign_keys.rb
Created January 21, 2016 16:38 — forked from myronmarston/without_foreign_keys.rb
Example of how to disable foreign keys for a particular context
RSpec.shared_context "without foreign key constraints", :disable_foreign_keys do
def without_foreign_key_checks
DB.run('SET foreign_key_checks = 0;')
yield
ensure
DB.run('SET foreign_key_checks = 1;')
end
around(:example) { |ex| without_foreign_key_checks(&ex) }
end
@orendon
orendon / GIF-Screencast-OSX.md
Created October 24, 2015 00:08 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@orendon
orendon / scalabooks.md
Created October 13, 2015 04:03 — forked from yujikiriki/scalabooks.md
Bibliografía recomendada para aprender Scala, por niveles.
@orendon
orendon / gist:cd9db1efaddab14136ed
Last active September 15, 2015 20:30 — forked from alex-zige/gist:5795358
Rails Rspec API Testing Notes

Rails Rspec APIs Testing Notes

Folders Structure

  spec
  |--- apis #do not put into controllers folder. 
        |--- your_api_test_spec.rb  
  |--- controllers
  |--- models
  |--- factories
 |--- views
@orendon
orendon / gist:994df0fbb0da04e33b60
Last active August 29, 2015 14:27 — forked from masonforest/gist:4048732
Installing a Gem on Heroku from a Private GitHub Repo

Installing a Gem on Heroku from a Private GitHub Repo

Sometimes you want to use a gem on Heroku that is in a private repository on GitHub.

Using git over http you can authenticate to GitHub using basic authentication. However, we don't want to embed usernames and passwords in Gemfiles. Instead, we can use authentication tokens.

  1. Get an OAuth Token from GitHub

First you will need to get an OAuth Token from GitHub using your own username and "note"