Skip to content

Instantly share code, notes, and snippets.

View jasonleonhard's full-sized avatar

jasonleonhard jasonleonhard

View GitHub Profile
lng lat
-122.79231919578592 45.619783717220
-122.79206328911766 45.621577190138
-122.79173767947158 45.623871402354
-122.79141980881165 45.625293820167
-122.79139212632786 45.625382855427
-122.79134413832539 45.625549974812
-122.79127366998294 45.625789735902
-122.79119623161218 45.626050556631
-122.79111555750978 45.626328074953
#!/usr/bin/env ruby
# bst is O(log(n)) # the inverse is O(n^2))
# Almost, the inverse of 2^n is log2(n)
# define Node with pointers left and right and data key|value pair
p Node = Struct.new(:data, :left, :right)
puts
# define tree having root and current
class Tree
attr_accessor :root
#!/usr/bin/env ruby
# reads in user provided parameter for function like ./readsFile2ReadIn.rb file2ReadIn
filename = ARGV.first
# when user forgets to provide parameter in function call like: ./readsFile2ReadIn4.rb
while !filename # if !filename # wont repeat and we want to repeat
print "file? \n"
file_again = $stdin.gets.chomp
print "Oh you want file: #{file_again} \n" # shows filename file2ReadIn which is not important...
#!/usr/bin/env bash
mkdir -p ~/.vimbundles
cd ~/.vimbundles
get_bundle() {
(
if [ -d "$2" ]; then
echo "Updating $1's $2"
cd "$2"
git pull --rebase
@jasonleonhard
jasonleonhard / gist:6d372a18acd0d98be047
Last active August 29, 2015 14:25
MONKEY PATCHING: Class and Method examples
# MONKEY PATCHING: Reopen and Add to Any Class in Ruby, including Gems and core Ruby.
# CLASS: naively sum elements in an Array
[1,2,3,4].sum
# undefined method `sum' for [1, 2, 3, 4]:Array (NoMethodError)
class Array
def sum
sum = 0
self.each do |e|
sum += e
end
// ==UserScript==
// @name remove_yt_a
// @description remove_yt_a
// @match *://*.youtube.com/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @grant GM_addStyle
// @version 0.4
// @author un5t0ppab13
// ==/UserScript==
@jasonleonhard
jasonleonhard / gist:4a7eaf639f376e076bea
Created June 24, 2015 23:14
CREATE A NEW REPO IN GITHUB OR BITBUCKET QUICKLY
NewRepo(){ # NewRepo RepoName5 ~/RepoLocalPath5/ g or # NewRepo Repo1 ~/RepoLocal1/ b
mkdir $2 ;
cd $2 ;
echo $1 | pbcopy ;
echo "$1 $2 $3 un5t0ppab13" >> $3.txt ; # create new file$3 with text"$1$2$3"
if [ -a "g.txt" ] ; then
open 'https://github.com/new/' ;
elif [ -a "b.txt" ] ; then
open 'https://bitbucket.org/repo/create' ;
fi ;

Keybase proof

I hereby claim:

  • I am un5t0ppab13 on github.
  • I am un5t0ppab13 (https://keybase.io/un5t0ppab13) on keybase.
  • I have a public key whose fingerprint is 608B EEC9 C5C2 EA49 7890 4A13 5B60 D4D7 8F68 6673

To claim this, I am signing this object:

@jasonleonhard
jasonleonhard / gist:5f0e672ee57207a36f2b
Last active August 29, 2015 14:22
Google Calendar Improved
/* GOOGLE CALENDAR Improved
You use google calendar right? Try this for fun (it is really quick):
open google chrome,
type command-Shift-C,
hit escape twice to see the console,
then paste this whole message in
and hit enter:
You can then hit command-shit-i to remove the console....
Just refresh if you don't like it... and it will go away. */
@jasonleonhard
jasonleonhard / gist:301d277a8684c0a9f79d
Last active March 11, 2024 04:38
Invert colors in Chrome Browser (with DevTools JavaScript console)
javascript: (function () {
// the css we are going to inject
var css =
"html {" +
" -webkit-filter: invert(100%);" +
" -moz-filter: invert(100%);" +
" -o-filter: invert(100%);" +
" -ms-filter: invert(100%);" +
"}",
head = document.getElementsByTagName("head")[0],