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
navigator.geolocation.getCurrentPosition(function(position) { | |
alert("lat" + position.coords.latitude + " long" + position.coords.longitude); | |
}); |
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
# simple hash methods for ruby 1.9.x | |
# maybe for rails object attributes :D | |
# for creating a similar user date time as a string can break in some cases or maybe just skip things you don't need | |
# ie: | |
# attributes = simplify_record(User.first.attributes, [:attributes, :i, :need, :and, :not, :date_time_string]) | |
# User.create(attributes) | |
def simplify_record(hash, keep) | |
hash.keep_if { |key| keep.include?(key) } | |
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
#!/bin/bash | |
# be sure to load .bash_profile which will load your rvm | |
shmux -c "source .bash_profile; git pull; bundle install" host1 host2 host3 |
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
class Album < ActiveRecord::Base | |
set_table_name "album" | |
## --------------------- Ignore columns patch ------ | |
@@ignore_column_pattern = /^column_one|^column_two/ | |
class << self | |
alias :all_columns :columns | |
def columns | |
@columns_filt ||= all_columns.reject { |col| col.name =~ @@ignore_column_pattern } | |
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
require 'cgi' | |
require 'fileutils' | |
desc 'Generate a code review.' | |
# Uses rake code_review[master,qa] by default | |
task :code_review, :left_branch, :right_branch do |cmd, args| | |
left_branch = ( args[:left_branch] || "master" ) | |
right_branch = ( args[:right_branch] || "qa" ) | |
gp = GitParser.new(left_branch, right_branch) | |
gp.fancy_full_diff |
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
# morse == ".... . .-.. .--. -- . --- ..- - --- ..-. - .... .. ... .-- . .-.. .-.." | |
words = morse.split(" ") | |
letters = [] | |
morse_code_map = { ".-" => :A, "-." => :N, | |
"-..." => :B, "---" => :O, | |
"-.-." => :C, ".--." => :P, | |
"-.." => :D, "--.-" => :Q, | |
"." => :E, ".-." => :R, | |
"..-." => :F, "..." => :S, | |
"--." => :G, "-" => :T, |
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
#!/usr/local/bin/ruby | |
require 'shellwords' | |
args = ARGV | |
size = args.size | |
tab_open = 'tell i term application "System Events" to keystroke "t" using {command down}' | |
v_pane_open = 'tell i term application "System Events" to keystroke "d" using {command down}' | |
h_pane_open = 'tell i term application "System Events" to keystroke "d" using {command down, shift down}' | |
go_left_one_pane = 'tell i term application "System Events" to key code 123 using {command down, option down}' | |
script_builder = Proc.new do |tell, command| |
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
$('*').click(function(e){ | |
var tagId = $(this).attr("id"); | |
if (tagId) { | |
myCssSelector = this.tagName + "#" + tagId; | |
var myClassName = $(this).attr("class"); | |
if (myClassName) { | |
myCssSelector = myCssSelector + "." + myClassName; | |
} else { | |
myCssSelector = myCssSelector + " "; | |
} |
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 "rubygems" | |
require "net/http" | |
require "net/https" | |
require "prawn" | |
require "json" | |
require "uri" | |
# ruby printy_mc_scrum.rb "https://my.jira.com/rest/api/latest/issue/" BKLOG-1234 userName password | |
# PrintyMcScrum.new("https://my.jira.com/rest/api/latest/issue/", "BKLOG-1728", "userName", "password") | |
class PrintyMcScrum | |
attr_accessor :pbi_s, :args, :user, :password, :issue_url |
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 'formula' | |
class Opensips < Formula | |
homepage '' | |
url 'http://opensips.org/pub/opensips/1.5.3/src/opensips-1.5.3-notls_src.tar.gz' | |
sha1 'c7f89f44a6c2637fd53fd695c6ccef27daa69621' | |
fails_with :clang do | |
build 318 | |
cause "Segfault while linking" |