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(rounds) | |
1.upto(rounds) do |num| | |
phrase = { fizz: 3, buzz: 5 }.select { |key, m| (num % m).zero? }.keys.join | |
puts phrase.empty? ? num : phrase | |
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
<script type="text/javascript"> | |
jQuery(document).ready(function(){ | |
// soundclip player | |
<?php | |
$raisin_id = get_latest_raisin_id(); | |
$mp3_id = get_post_meta($raisin_id, "raisin_mp3_id", true); | |
$mp3_url = wp_get_attachment_url($mp3_id); | |
$ogg_id = get_post_meta($raisin_id, "raisin_ogg_id", true); | |
$ogg_url = wp_get_attachment_url($ogg_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
def left_match(arr, idx) | |
num = arr[idx] | |
unless idx.zero? | |
(idx - 1).downto(0) do |i| | |
return i if arr[i] > num | |
end | |
end | |
nil | |
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
def nearest_larger(arr, idx) | |
diff = 1 | |
loop do | |
left = idx - diff | |
right = idx + diff | |
diff += 1 | |
if (left >= 0) && (arr[left] > arr[idx]) | |
return left | |
elsif (right < arr.length) && (arr[right] > arr[idx]) |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>ANSIBlackColor</key> | |
<data> | |
YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS | |
AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPECgw | |
LjE1NjE5MDIxMDUgMC4wMTk1OTcyNTAxNSAwLjEzOTY3MzE4NjEAEAGAAtIQERITWiRj | |
bGFzc25hbWVYJGNsYXNzZXNXTlNDb2xvcqISFFhOU09iamVjdF8QD05TS2V5ZWRBcmNo |
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
Show hidden characters
{ | |
"font_size": 20, | |
"date_format": "(%Y-%m-%d %H:%M)", | |
"color_scheme": "Packages/PlainTasks/tasks-monokai.hidden-tmTheme" | |
} |
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
// Write a function to get the common letters out of two strings | |
// commonLetters('hello world', 'hello moon') => should return 'helo' | |
function commonLetters(str1, str2) { | |
var map = {}, | |
common = ''; | |
for (var i = 0; i < str1.length; i++) { | |
var letter = str1[i]; | |
if (letter != ' ') map[letter] = true; |
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 jquery | |
//= require track-events | |
describe('TrackEvents', function () { | |
beforeEach(function () { | |
loadFixtures('track-events_fixture'); | |
}); | |
it('triggers a Test.fire', function() { | |
Test = function () { } |
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
# Build a function morse_encode that takes in a word (no numbers or | |
# punctuation) and outputs the morse code for it. Put two spaces between | |
# words and one space between letters. | |
# http://www.w1wc.com/pdf_files/international_morse_code.pdf | |
def morse_encode(str) | |
morse_codes = { a: ".-", b: "-...", c: "-.-.", d: "-..", e: ".", f: "..-.", | |
g: "--.", h: "....", i: "..", j: ".---", k: "-.-", l: ".-..", | |
m: "--", n: "-.", o: "---", p: ".--.", q: "--.-", r: ".-.", | |
s: "...", t: "-", u: "..-", v: "...-", w: ".--", x: "-..-", |
OlderNewer