This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Enlaces Entradas | |
| // @namespace http://use.i.E.your.homepage/ | |
| // @version 0.1 | |
| // @description enter something useful | |
| // @match http://entradas/* | |
| // @copyright 2012+, You | |
| // ==/UserScript== | |
| $("a[href^=\\/]").not("a[href^=\\/entradas]").css({"padding":"2.5px", "outline": "1px dashed #000", "border": "2.5px solid #DD0"}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Foo | |
| class << self | |
| def cls_method | |
| "cls_method" | |
| end | |
| end | |
| def ins_method | |
| self.class.cls_method | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "ostruct" | |
| obj = OpenStruct.new(a: "a", b: "b", to_ary: ["a", "b"] ) | |
| a, b = obj | |
| puts "a: #{a}" | |
| puts "b: #{b}" | |
| obj = OpenStruct.new(a: "a", b: "b") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # http://www.rubytapas.com/episodes/7-Constructors | |
| class RpsMove | |
| def self.new(move) | |
| @cache ||= {} | |
| @cache[move] ||= super(move) | |
| end | |
| def initialize(move) | |
| @move = move |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'rest_client' | |
| require 'json' | |
| require 'pp' | |
| COUCHDB = "http://localhost:5984/dbname" | |
| filters_doc = { | |
| "_id" => "_design/app", | |
| "filters" => { | |
| "people"=> "function(doc, req) { return doc.type == 'person' }" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Usage: redis-cli publish message hello | |
| require 'sinatra' | |
| require 'redis' | |
| conns = [] | |
| get '/' do | |
| erb :index | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from collections import Iterable | |
| import numpy as np | |
| import math | |
| class LogQueue(object): | |
| """Collection for store a degradable history""" | |
| def __init__(self, size=5, depth=1): | |
| super(LogQueue, self).__init__() | |
| self.items = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| sudo mv /usr/bin/xdg-open /usr/bin/xdg-open.bak | |
| sudo curl https://gist.github.com/weapp/4717249/raw/16b3ce7ae4c4e63162ca0d9e47b2805d410bfa14/xdg-open.rb -o /usr/bin/xdg-open | |
| sudo chmod a+x /usr/bin/xdg-open |
NewerOlder