Skip to content

Instantly share code, notes, and snippets.

@cschneid
cschneid / default_attributes.rb
Created October 24, 2012 03:40 — forked from charlesjohnson/default_attributes.rb
Ark library usage example
default['elasticsearch']['version'] = "0.19.6"
default['elasticsearch']['checksum'] = 'f0ec550fb86c4bc8f08afb15de4e197e85f9fcfd352fbb7eb49aaff98f7731dd'
default['elasticsearch']['url'] = "http://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-#{node['elasticsearch']['version']}.tar.gz"
default['elasticsearch']['home_path'] = "/usr/lib"
default['elasticsearch']['home_dir'] = "#{node['elasticsearch']['home_path']}/elasticsearch"
tell application "Safari" to set recipeurl to URL of front document
tell application "Safari" to set recipetitle to name of front document
set ingredients to (do shell script "curl http://recipedistiller.com/recipe/classify/?recipeurl=" & recipeurl & " | textutil -convert txt -stdin -stdout | grep '.' | sed 's/ • DELETE //g'")
set my text item delimiters to "VIEW RECIPE"
set ingredients to text item 2 of ingredients
set my text item delimiters to "©"
set ingredients to text item 1 of ingredients
@cschneid
cschneid / Guardfile
Created February 14, 2013 22:51 — forked from tubbo/Guardfile
guard 'bundler' do
watch('Gemfile')
end
guard 'livereload' do
watch(%r{app/views/.+\.(erb|haml|md|builder|jbuilder)})
watch(%r{app/helpers/.+\.rb})
watch(%r{public/.+\.(css|js|html)})
watch(%r{config/locales/.+\.yml})
watch(%r{(app|vendor)/assets/\w+/(.+\.(css|js|html)).*}) { |m| "/assets/#{m[2]}" }
@cschneid
cschneid / 0_reuse_code.js
Created January 2, 2014 20:09
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
Average Semigroup
=================
> {-# LANGUAGE GeneralizedNewtypeDeriving #-}
>
> module Average where
>
> import Data.Semigroup
> import Data.Ratio (Ratio, (%))

% Title % Name % Date

My first slide

List

Useful Scalac Flags

So, there have been some discussions and angry tweets recently about irritating Scala "features" (like value discarding and auto-tupling) that can actually be turned off by selecting the right compiler flag in conjunction with -Xfatal-warnings. I highly recommend a set of options something like those below.

scalacOptions ++= Seq(
  "-deprecation",           
  "-encoding", "UTF-8",       // yes, this is 2 args
  "-feature",                
 "-language:existentials",
scala> import argonaut._, Argonaut._
import argonaut._
import Argonaut._
scala> Map( "foo" -> List("bar","baz") , "test" -> List() ) .jencode.spaces2
res7: String =
{
"foo" : [
"bar",
"baz"

I like Learn You a Haskell as a reference and cheat-sheet but I found it a little slow for learning Haskell.

Here's my recommended order for just learning Haskell:

http://www.seas.upenn.edu/~cis194/lectures.html Brent Yorgey's course is the best I've found so far and replaces both Yann Esposito's HF&H and the NICTA course. This course is particularly valuable as it will not only equip you to write Haskell but also help you understand parser combinators.

Real World Haskell is available online. (Thanks bos!)

I recommend RWH as a reference (thick book). The chapters for parsing and monads are great for getting a sense for where monads are useful. Other people have said that they've liked it a lot. Perhaps a good follow-up for practical idioms after you've got the essentials of Haskell down?