This file contains 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
<script> | |
var toggle = function(){ | |
alert("She loves me!"); | |
var that = toggle; | |
toggle = function(){ | |
alert("She loves me not!"); | |
toggle = that; | |
} | |
} |
This file contains 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
RAILS SHELL APPLICATION IN 10 STEPS !!! | |
1.- rails shell -d mysql | |
2.- cd shell | |
3.- Edit config/database.yml | |
4.- rake db:create | |
5.- ruby script\generate scaffold Command execute:string | |
6.- rake db:migrate | |
7.- Delete public/index.html | |
8.- Edit config/routes.rb | |
map.resources :commands |
This file contains 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 'time' | |
def average_time_of_day(args) | |
sum = 0 | |
args.each do |arg| | |
sum += Time.parse(arg).to_i | |
sum += 60 * 60 * 24 unless arg =~ /^1[01].*pm$/ # My friend arrival is scheduled at 10pm so any time outside 10:00pm and 11:59pm means he arrived on the very next day | |
end | |
average = sum / args.length | |
Time.at(average).strftime("%l:%M%p").strip.downcase | |
end |
This file contains 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
git config --global svn.addAuthorFrom true | |
git config --global svn.useLogAuthor true | |
git svn clone NEW_URL new | |
git svn clone ORIGINAL_URL original | |
cd original | |
git push ../new/.git master:refs/heads/original | |
cd ../new | |
git filter-branch --msg-filter 'sed -e /^git-svn-id:/d' original | |
echo `git rev-list original | tail -1` `git rev-list master | tail -1` >> .git/info/grafts | |
git merge original |
This file contains 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/bash | |
# init | |
SAVEIFS=$IFS | |
IFS=$(echo -en "\n\b") | |
# look for empty dir | |
for SUBDIR in `find . -type d | grep -v .svn`; do | |
if [ ! "$(ls $SUBDIR)" ]; then | |
rm -rf $SUBDIR | |
echo "$SUBDIR is Empty" |
This file contains 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 com.sun.org.apache.bcel.internal.classfile.JavaClass; | |
import java.util.Arrays; | |
import javax.xml.xpath.*; | |
import java.io.File; | |
import java.io.FileInputStream; | |
import org.xml.sax.InputSource; | |
import org.w3c.dom.Node; | |
import org.w3c.dom.NodeList; | |
import java.util.HashSet; | |
import java.net.URLDecoder; |
This file contains 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'; |
This file contains 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 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 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); | |
} |