(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| from Foundation import * | |
| from AppKit import NSAttributedString | |
| import os | |
| class Sticky(NSObject): | |
| """A Stickies document. | |
| Attributes (from class dump): | |
| int windowColor | |
| int windowFlags |
| #!/usr/bin/env ruby | |
| # | |
| # "speak" makes it easy to interact with OS X's "say" command. | |
| # | |
| # * "?" to show voice list | |
| # * "-8" to select a voice | |
| # * up and down arrows to move through history | |
| require 'readline' |
| function sendError(message, url, lineNum) { | |
| var i; | |
| // First check the URL and line number of the error | |
| url = url || window.location.href; | |
| lineNum = lineNum || 'None'; | |
| // If the error is from these 3rd party script URLs, we ignore | |
| // We could also just ignore errors from all scripts that aren't our own | |
| var scriptURLs = [ |
| #all local branches that are merged into HEAD | |
| git branch -d `git branch --merged | grep -v '^*' | tr -d '\n'` | |
| #Delete all remote branches that are merged into HEAD | |
| #jump back to master | |
| git co master | |
| #get rid of all local branches not on origin |
| story_create | |
| add_story_label | |
| story_label_add | |
| remove_story_label | |
| story_label_remove | |
| comment_create | |
| comment_delete | |
| story_move_multi | |
| multi_story_delete | |
| story_delete_multi |
| require 'nokogiri' | |
| require 'httparty' | |
| puts "Scraping ids of detainees in custody" | |
| ids = [] | |
| (1..10).each do |n| | |
| response = HTTParty.get "http://projects.nytimes.com/guantanamo/detainees/held?page=#{n}" | |
| page = Nokogiri::HTML(response) | |
| ids += page.css('#detaineesTable a').map { |link| $1 if /detainees\/(\d+)/ =~ link['href'] }.compact | |
| end |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
brew install nginx
sudo cp /usr/local/Cellar/nginx/1.8.0/homebrew.mxcl.nginx.plist /Library/LaunchAgentsReplace /usr/local/etc/nginx/nginx.conf with the nginx.conf in this gist. I'm using port 5000 for my current project. Obviously, change server_name as well, and probably the name of its access log.
| import Cocoa | |
| // for-in | |
| func checkForIn(array: [Int], dict: [Int: String]) { | |
| for num in array where dict[num] != nil { | |
| num | |
| } | |
| } | |
| checkForIn([1,2,3,4], dict: [1:"one", 2:"two"]) |
| #1B2B34,#4F5B66,#5FB3B3,#ffffff,#4F5B66,#FFFFFF,#5FB3B3,#EC5f67 |