Skip to content

Instantly share code, notes, and snippets.

View weapp's full-sized avatar
💸

Manuel Albarran weapp

💸
View GitHub Profile
require "pp"
block_size = 4_096
def tags_from_file(filename)
no_tag_or_tag = /([^<>]+)|(<\/[^<>]+>)|(<[^<>]+?\/>)|(<\!\[CDATA\[(?:.*?)\]\]>)|(<[^!a-zA-Z][^<>]+>)|(<[^<>]+>)/
reg_exp = /\A(?<p>(?:#{no_tag_or_tag}))*\g<p>*/
block_size = 4_096
Enumerator.new do |enum|
#!/bin/bash
cd ~/projects/
echo -en '\033]2;'$1'\007' # set the title of the window
case "$1" in
wubytes) cd wubytes && foreman start;;
kiwitime) cd kiwitime && rails s -p 5000;;
#!/usr/bin/env ruby
# require 'bundler/setup'
# Bundler.require(:default)
module F
ZERO = -> p { -> x { x } }
ONE = -> p { -> x { p[x] } }
TWO = -> p { -> x { p[p[x]] } }
@weapp
weapp / life.js
Last active August 29, 2015 14:26 — forked from faddah/life.js
function from Lea Verou's version of Conway's Game Of Life
(function() {
var buttons = {
next: $('button.next')
};
buttons.next.addEventListener('click', function() {
lifeView.next();
});
{ title: "My ER Diagram" }
# Tables
[User] { color: :blue }
*id
blog_id* <nullable>
name
[Blog] { color: :orange }
*id
@weapp
weapp / tail-color.sh
Last active August 29, 2015 14:26 — forked from kartikshah/tail-color.sh
Color output of linux tail command
$tail -100f /var/log/applications/application.log | awk '
/INFO/ {print "\033[32m" $0 "\033[39m"}
/Exception/ {print "\033[31m" $0 "\033[39m"}
'
@weapp
weapp / benchmark.rb
Created August 7, 2015 08:58
Faraday backends
require 'benchmark/ips'
require 'faraday'
require 'excon'
require 'typhoeus'#, '~> 0.3.3'
require 'patron'
require 'net-http-persistent'
default_adapter = Faraday.new(:url => 'http://localhost') do |faraday|
faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
end
@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) {
[
{ "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" },