This file contains hidden or 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
| (defn get-words-from-file [file-name] | |
| (into [] (re-seq #"\b[a-zA-Z]+\b" (slurp file-name)))) | |
| (defn is-anagram? [word1 word2] | |
| (let [word1-letters (seq word1) | |
| word2-letters (seq word2)] | |
| (= (sort word1-letters) (sort word2-letters)))) | |
| (defn get-ana-set [word other-words] | |
| (loop [words other-words |
This file contains hidden or 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
| package main | |
| import ( | |
| "net/http" | |
| "encoding/json" | |
| "github.com/gorilla/mux" | |
| ) | |
| func HomeHandler(rw http.ResponseWriter, r *http.Request) { | |
| rw.Header().Set("Content-Type", "application/json") |
This file contains hidden or 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
| package main | |
| import ( | |
| "fmt" | |
| "net/http" | |
| "net/url" | |
| "os" | |
| "io/ioutil" | |
| ) |
This file contains hidden or 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
| package main | |
| import ( | |
| "fmt" | |
| "reflect" | |
| ) | |
| type Example struct { | |
| A string | |
| B string |
This file contains hidden or 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
| import random | |
| def coroutine(func): | |
| """A decorator to automatically prime coroutines""" | |
| def start(*args, **kwargs): | |
| cr = func(*args, **kwargs) | |
| next(cr) | |
| return cr | |
| return start |
This file contains hidden or 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
| file * | grep -v text | cut -d':' -f1 | xargs rm |
This file contains hidden or 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 'chunky_png' | |
| include ChunkyPNG::Color | |
| images = [ChunkyPNG::Image.from_file('dog1.png'), # Put yr files here | |
| ChunkyPNG::Image.from_file('dog2.png')] | |
| output = ChunkyPNG::Image.new(images.first.width, images.last.height, rgb(255, 255, 255)) | |
| height = images.first.height > images.last.height ? images.last.height : images.first.height | |
| width = images.first.width > images.last.width ? images.last.width : images.first.width |
This file contains hidden or 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
| USAGE = \ | |
| """ | |
| Searches an XCode project to determine which image | |
| assets aren't being used then removes them. | |
| WARNING: This will delete things permanently if your | |
| project is not under source control. | |
| """ | |
| import os |
This file contains hidden or 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
| git config --global alias.history "log --follow --stat" |
This file contains hidden or 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
| import urllib2 | |
| from bs4 import BeautifulSoup | |
| PAGES_TO_SCRAPE = 10 | |
| # Get HTML for all deck listing pages | |
| htmls = [] | |
| for x in range(PAGES_TO_SCRAPE): | |
| print "SCRAPING PAGE " + str(x + 1) |
OlderNewer