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
| def fib n | |
| case n | |
| when 0..1 then n | |
| else fib(n-1) + fib(n-2) | |
| end | |
| end | |
| # thouth it should be rewritten as a loop to avoid a stackoverflow |
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
| begin | |
| response = Net::HTTP.post_form("...") | |
| rescue Timeout::Error, | |
| Errno::EINVAL, | |
| Errno::ECONNRESET, | |
| EOFError, | |
| Net::HTTPBadResponse | |
| Net::HTTPHeaderSyntaxError, | |
| Net::ProtocolError => e | |
| # ... |
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
| import java.util.*; | |
| public class TestThread extends Thread | |
| { | |
| public static void main(String[] args){ | |
| new TestThread().start(); | |
| new TestThread().start(); | |
| } | |
| public void run(){ | |
| Vector<Safe> aList= new Vector<Safe>(); | |
| for(Integer i = 0; i<3; i++) |
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
| function isArray(o) { | |
| return Object.prototype.toString.call(o) === '[object Array]'; | |
| } |
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
| # Generate a random string of length 4 or more consisting of only the following | |
| set of characters: a-z, A-Z, 0-9 | |
| (0..4).map{rand(?z).chr[/[^_\W]/]||redo}.join |
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
| sudo env ARCHFLAGS="-arch i386" gem install mysql -- \ | |
| --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib \ | |
| --with-mysql-include=/usr/local/mysql/include |
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
| public class StringTest | |
| { | |
| public static void main (String [] args) | |
| { | |
| String a = "Esto no se va a imprimir"; | |
| String b = "Esto se va a imprimir"; | |
| a = b; | |
| b = "Esto parece que se va a imprimir, pero NO!"; | |
| System.out.println(a); | |
| } |
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
| ActiveRecord::Base.logger = Logger.new("#{RAILS_ROOT}/log/#{RAILS_ENV}_database.log") | |
| config.action_controller.relative_url_root = "/<sub-uri>" |
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
| defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}' | |
| killall Dock |
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 export_somethings_data.js | |
| // @namespace jbgutierrez.info | |
| // @description Export "Somethings" data | |
| // @include http://thn.gs/ | |
| // ==/UserScript== | |
| // Add jQuery | |
| var GM_JQ = document.createElement('script'); | |
| GM_JQ.src = 'http://jquery.com/src/jquery-latest.js'; |
OlderNewer