This bookmarklet will open a Spotify link in the Spotify app. To install, create a new bookmarklet and paste the contents of the spotify.js
file as the URL. Use something like Open in Spotify
for the name.
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
for i in (1...100) { | |
if (i % 3 == 0 && i % 5 == 0) { | |
println("fizzbuzz") | |
} else if i % 3 == 0 { | |
println("fizz") | |
} else if i % 5 == 0 { | |
println("buzz") | |
} else { | |
println(i) | |
} |
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
let path = NSURL(string: NSHomeDirectory()) | |
let fileManager = NSFileManager.defaultManager() | |
let enumerator = fileManager.enumeratorAtURL(path, includingPropertiesForKeys: [NSURLIsDirectoryKey], options: nil, errorHandler: nil) | |
for urls in enumerator { | |
} |
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
def fizz_buzz(n) | |
three = ['fizz', nil, nil] | |
five = ['buzz', nil, nil, nil, nil] | |
three_five = ['fizzbuzz', nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil] | |
1.upto(n) do |i| | |
puts three_five[i % 15] || three[i % 3] || five[i % 5] || i | |
end | |
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 'socket' | |
host = 'their.ip.address' | |
port = 33_333 | |
udpsock = UDPSocket.new | |
udpsock.setsockopt(Socket::SOL_SOCKET, Socket::SO_BROADCAST, true) | |
loop do | |
data = gets.chomp |
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 'colored' | |
christmas = Thread.new do | |
1.upto(10) do | |
print "Christmas\n".green | |
sleep(1) | |
end | |
end | |
merry = Thread.new do |
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 String | |
def rotate(n = 1) | |
chars.rotate(n).join | |
end | |
def rotate!(n = 1) | |
replace(rotate(n)) | |
end | |
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
remove_column :table, :id, :primary_key | |
add_column :table, :id, :uuid, default: 'uuid_generate_v4()' | |
execute('ALTER TABLE table ADD PRIMARY KEY (id);') |
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
function getSeason (dateString) { // format "mm/dd/yy" | |
var d = typeof(dateString) == "undefined" ? new Date() : new Date(dateString), // use today if nothing is passed in | |
month = d.getMonth()+1, | |
day = d.getDate(), | |
seasonCode = month+(day/100); // mm.dd | |
if (seasonCode < 3.21) { return "Winter"} | |
else if (seasonCode < 6.21) { return "Spring"} | |
else if (seasonCode < 9.22) { return "Summer"} | |
else if (seasonCode < 12.21) { return "Fall"} |
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
button { | |
-moz-box-shadow: inset 0px 1px 0px 0px #ffffff; | |
-webkit-box-shadow: inset 0px 1px 0px 0px #ffffff; | |
box-shadow: inset 0px 1px 0px 0px #ffffff; | |
background: -webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #dfdfdf) ); | |
background: -moz-linear-gradient( center top, #ededed 5%, #dfdfdf 100% ); | |
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#dfdfdf'); | |
background-color: #ededed; | |
-moz-border-radius: 2em; |
OlderNewer