Skip to content

Instantly share code, notes, and snippets.

Luis Borjas Reyes lfborjas

Block or report user

Report or block lfborjas

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
@lfborjas
lfborjas / mens.sql
Last active Nov 14, 2015
Flipping: M Nov 2015
View mens.sql
CREATE TEMPORARY TABLE boxes_to_restore
(rebillable_id int(10) unsigned,
bh_id int(10) unsigned,
billing_frequency tinyint(3) unsigned,
prev_cycle_status int(10) unsigned,
unique index (rebillable_id),
unique index (bh_id));
INSERT INTO boxes_to_restore (rebillable_id, bh_id, billing_frequency, prev_cycle_status)
SELECT rs.rebillable_id as rebillable_id, bh2.id as bh_id, rs.billing_frequency as billing_frequency, COALESCE(SUM(ctl.result='success')*100 - SUM(ctl.result='failure'),0) as prev_cycle_status
View luis.vim
syntax on
autocmd Filetype html setlocal ts=2 sw=2 expandtab
autocmd Filetype ruby setlocal ts=2 sw=2 expandtab
autocmd Filetype javascript setlocal ts=2 sw=2 expandtab
autocmd Filetype cucumber setlocal ts=2 sw=2 expandtab
set noswapfile
au BufRead,BufNewFile *.md set filetype=markdown
au BufRead,BufNewFile *.md.html set filetype=markdown
View ejemplo.js
function activarFormulario(){
var form = document.querySelector("form");
form.addEventListener("submit", function(event) {
event.preventDefault();
var r = document.getElementById("result");
var n = document.getElementById("GET-nombre");
r.textContent = n.value;
});
}
View composition.rb
class Dog < Animal
def pet
dog_petter.pet
end
private
def dog_petter
DogPetter.new
end
end
@lfborjas
lfborjas / application.rb
Created Jul 31, 2013
inspect the rack env before it hits the rails app
View application.rb
#config/application.rb
config.middleware.use "Peekaboo"
@lfborjas
lfborjas / Gemfile
Last active Dec 15, 2015
prueba de concepto de app
View Gemfile
gem 'sinatra'
gem 'rest-client'
gem 'json' #probablemente innecesaria
@lfborjas
lfborjas / fake_endpoints.rb
Created Mar 18, 2013
Serves a rack app based on paths/responses defined in a cucumber feature
View fake_endpoints.rb
require 'gherkin/parser/parser'
require 'gherkin/formatter/json_formatter'
#This is intended to be mounted on top of a rails app with
#mount FakeEndpoints => "/fake_api"
#this allows clients to play around with an intended implementation of the API without it being actually coded at all
#the features look like
# Given I GET /an/endpoint; Then the JSON response is:
class FakeEndpoints
def initialize
@routes = gather_routes
View ugh.rb
eval(
(%w[
1 0
1 0 0
]).zip(%w[
o d
e v n
]).map{ |(to, fro)|
%Q{
#{to}.upto(9) do |#{fro}|
View fun.js
//The fun solution: using array methods
var ary = [];
for(var i = 1; i <= 1000; i++){ ary.push(i); }
console.log(
ary.filter(function(item){
return (item % 3 == 0 || item % 5 == 0)
}).reduce(function(memo, current){
return memo + current
}, 0)
);
View yodawg.html
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Brainfuck</title>
<script type="text/javascript" charset="utf-8">
/*
Google HTML5 slides template
Authors: Luke Mahé (code)
You can’t perform that action at this time.