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
UIScrollView* timer = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 120, 700, 60)]; | |
timer.backgroundColor = [UIColor whiteColor]; | |
timer.delegate = self; | |
timer.scrollEnabled = YES; | |
timer.contentSize = CGSizeMake(_createView.frame.size.width+700, 60); | |
[self addTopBorder:timer]; | |
for (int i = 55; i > 0; i--) { | |
UIView *tine = [[UIView alloc] initWithFrame:CGRectMake((i*12), 1, 1, 7)]; |
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
# This is a dump of the word list | |
text = File.read ARGV[0] | |
words = text.split("\n") | |
hash = {} | |
words.each do |word| | |
word.each_char do |l| | |
hash[l] ||= 0 | |
if hash.keys.include?(l) | |
hash[l] += 1 |
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 getElementsByClassName(className) { | |
var elements = document.body, | |
matches = []; | |
function traverse(node) { | |
for(var i = 0; i < node.childNodes.length; i++) { | |
if(node.childNodes[i].childNodes.length > 0) { | |
traverse(node.childNodes[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
#!/usr/bin/ruby | |
# Group all words that are anagrams of one another | |
# example: | |
# sample set of words | |
# dict = %w[cat tar war store core orb bro rat] | |
# $ ruby anagram.rb | |
# expect | |
# { | |
# "act"=>["cat"], |
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 Node | |
attr_accessor :next, :data | |
def push(str) | |
new_node= Node.new | |
new_node.data = str | |
node = self | |
while node.next |
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 retina(selector) { | |
var element = document.querySelector(selector); | |
var images = Array.prototype.slice.apply(element.getElementsByTagName("img")); | |
var extension = "_2x"; | |
if (window.devicePixelRatio === 2) { | |
images.forEach(function(img, idx) { | |
var src = img.getAttribute('src'); | |
img.setAttribute('src', src.replace(/(\.jpg|\.png|\.gif)$/, extension + '$&')); | |
img.onerror = function(evt) { | |
img.setAttribute('src', src); |
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 'open-uri' | |
require 'csv' | |
require 'rest_client' | |
csv = open("path/to/file.csv") # I choose csv, you can choose whatever file you want to loop through | |
arr = [] | |
CSV.parse(csv) do |row| | |
cell_num = row[2] #row for cell number | |
home_num = row[3] #row for home_num |
NewerOlder