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
piece :: Parser Piece | |
piece = do | |
many space | |
t <- pieceType | |
c <- pieceColour | |
return $ Piece t c |
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
Download + Install Firefox in English (http://www.mozilla.org/en-US/firefox/all/) | |
Download + Install XCode and XCode command line tools. (https://developer.apple.com/downloads/) | |
Download + Install ITerm2 | |
Download Solarized. | |
Install Solarized for ITerm2: http://michaelheap.com/solarized-with-iterm2/ | |
Download + Install Chrome in English (https://www.google.com/intl/en/chrome/) | |
Install homebrew http://brew.sh/ | |
brew install vim | |
brew install tmux | |
brew install wget |
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
upstream tarnbarfordnet { | |
server localhost:8000; | |
} | |
server { | |
root /usr/share/nginx/www; | |
index index.html index.htm; | |
server_name localhost; |
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
We encountered some issues using python processes with storm. | |
1) Storm uses the stdin and stdout of the python processes to communicate with them. This makes them almost impossible to debug with pdb.set_trace(). | |
2) The local topology (and the real storm to a lesser extent) has issues killing the Python processes it creates. Some of our rouge processes pin the CPU. I find myself running something like this on my local machine. | |
ps aux | grep python | awk '{ print $2 }' | xargs kill | |
3) We didn't want to install python packages in the system packages because it adds dependencies on the system storm is running on and we also have different topologies with different bolts that depend of different versions of packages. We install the dependencies (with buildout or virtualenv) in a relative path before creating the uberjar and deploying it, or you can also make the script storm calls a shell script that installs the dependencies locally then runs the python entry point. Either way, it is a little painful, espe |
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 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
window.MyView = Backbone.View.extend({ | |
initialize: -> | |
_.bindAll(this,'render') | |
this.template = window.JST["MyView"] | |
this.model.bind('change', this.render) | |
render: -> | |
$(this.el).html(this.template(this.model.toJSON())) | |
events: { |
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
public bool Authenticate() | |
{ | |
var FacebookAppId = ConfigurationManager.AppSettings["FACEBOOK_APPID"]; | |
var FacebookAppSecret = ConfigurationManager.AppSettings["FACEBOOK_SECRET"]; | |
var cookie = Request.Cookies["fbs_" + FacebookAppId]; | |
if (cookie == null) return false; | |
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
// Good times with Umbraco. This time with the broken link checker plug-in (http://our.umbraco.org/projects/developer-tools/broken-link-checker) | |
// To be fair I think these problems are mainly due to changes in Umbraco > 4.0. | |
// | |
// I wouldn't recommend using the plugin, but I had to put in this hacky fix it for a client who wanted to use it. | |
// | |
// Firstly it tries to download some javascript from here: | |
// http://localhost:50812/umbraco/~/umbraco/plugins/FergusonMoriyama/DashRss/dashrss.js | |
// | |
// When the location of the file is: | |
// http://localhost:50812/umbraco/plugins/FergusonMoriyama/DashRss/dashrss.js |
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 seems way too difficult for what you would expect to be a pretty common task; | |
// taking a search string from the user and finding documents which contain some or all of the terms | |
// in the search string. | |
// This function naively splits a search string into terms and finds documents | |
// which contain some or all of the terms. Does not handle quoted terms as or ignore case as it should. | |
public IEnumerable<SearchResult> Search(string searchString, string[] fields) | |
{ | |
// Spit the search string and return an empty list if no search string was provided. | |
if (string.IsNullOrEmpty(searchString)) return new List<SearchResult>(); |
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
$ ghci | |
GHCi, version 6.12.1: http://www.haskell.org/ghc/ :? for help | |
Prelude> let make = (\a b -> take b (repeat a)) | |
Prelude> ("abc",123) `make` 3 | |
[("abc",123),("abc",123),("abc",123)] |