Skip to content

Instantly share code, notes, and snippets.

View weapp's full-sized avatar
💸

Manuel Albarran weapp

💸
View GitHub Profile
@weapp
weapp / __README__.md
Last active February 20, 2017 23:27
GildedRose

based on: https://github.com/jimweirich/gilded_rose_kata

The Gilded Rose Code Kata

This is a Elixir version of the Gilded Rose Kata, found here.

This is a refactorying kata, so you will be starting with a legacy code base. To work the Kata, clone this git repository and checkout the tag 'start-here'. Read the description below for the "rules"

@weapp
weapp / Gemfile
Last active February 8, 2017 14:21
Paypal + Sinatra Integration
# -*- coding: utf-8 -*-
source 'https://rubygems.org'
gem 'sinatra'
gem 'faraday'
RSpec::Support::Differ.new(color:true).diff("a\na\na\na\na\n", "a\na\na\na\nb\na\n")
require 'securerandom'
require 'benchmark/ips'
hashs = 20.times.map do
20.times.map { [SecureRandom.hex(2), SecureRandom.hex(2)] }.to_h
end
Benchmark.ips do |x|
x.time = 5
x.warmup = 2
@weapp
weapp / application.rb
Created December 3, 2015 03:26
RequestId
# http://stackoverflow.com/a/9380164/1171712
module MyFancyApp
class Application < Rails::Application
config.log_tags = [:uuid, :remote_ip]
end
end
@weapp
weapp / selfdestruct.rb
Last active November 9, 2015 20:38
This message will self destruct
str = " [ = This message will self destruct = ]"
wave = -> max { [*0.upto(max), *max.downto(0)] }
puts
wave[str.length].each do |char|
sleep(0.05)
print "\r\e[2K#{str[0..char]}"
end
print "\e[M\e[1A\r"
@weapp
weapp / Gemfile
Last active March 13, 2018 23:26
groups, tree
# frozen_string_literal: true
source "https://rubygems.org"
group :development, :test do
gem "pry"
end
@weapp
weapp / Gemfile
Last active September 30, 2015 22:02
RedBunny. redlock + bunny. redis + rabbitmq
# -*- coding: utf-8 -*-
source 'https://rubygems.org'
gem "pry", group: 'development'
gem "bunny", ">= 2.1.0"
gem "redlock"
[
{ "keys": ["ctrl+alt+super+d"], "command": "toggle_side_bar" },
{ "keys": ["super+l"], "command": "show_overlay", "args": {"overlay": "goto", "text": ":"} },
{ "keys": ["super+shift+l"], "command": "expand_selection", "args": {"to": "line"} },
{ "keys": ["ctrl+super+r"], "command": "reveal_in_side_bar" },
{ "keys": ["alt+shift+up"], "command": "select_lines", "args": {"forward": false} },
{ "keys": ["alt+shift+down"], "command": "select_lines", "args": {"forward": true} },
{ "keys": ["ctrl+shift+<"], "command": "erb" },
{ "keys": ["super+shift+t"], "command": "reopen_last_file" },
{ "keys": ["super+i"], "command": "copy_path" },
@weapp
weapp / at.sjs
Last active September 13, 2015 15:54
Macros
// https://gist.github.com/mateuspv/45bfb3e10a84e34b0074
/**
Sweet.js version: 0.7.2
`this` nickname `@`
Expected:
@ -> this
@something -> this.something
example:
function hello (tag) {