Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.
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
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc | |
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/ | |
// author: Pawel Kozlowski | |
var myApp = angular.module('myApp', []); | |
//service style, probably the simplest one | |
myApp.service('helloWorldFromService', function() { | |
this.sayHello = function() { | |
return "Hello, World!" |
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
<html ng-app="ng-demo-app"> | |
<head> | |
<title>AngularJS simple app demo</title> | |
</head> | |
<body ng-controller="MainCtrl"> | |
<input type="text" ng-model="name" ng-required> | |
<div>{{name}}</div> | |
<div ng-controller="ChildCtrl"> | |
<input type="text" ng-model="salut"> | |
<div>{{salutation}}</div> |
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
(* Inspired and modified based on http://drosophiliac.com/2012/09/an-academic-notetaking-workflow.html and https://gist.github.com/smargh/6068104 *) | |
(* PROPERTIES *) | |
property LF : (ASCII character 10) | |
property tid : AppleScript's text item delimiters | |
(* THE SCRIPT *) | |
tell application "Skim" | |
set the clipboard to "" | |
activate |
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
package speculation | |
import java.util.concurrent.{ Callable, ExecutorService, Future } | |
class Speculation(val executor: ExecutorService, val mayInterruptIfRunning: Boolean) { | |
def spec[A,B](guess: => A)(f: A => B)(actual: => A): B = { | |
val g = executor.submit(new Callable[A] { | |
def call = guess | |
}) | |
val speculation = executor.submit(new Callable[B] { |
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
{-# LANGUAGE GADTs, Rank2Types, KindSignatures, ScopedTypeVariables, TypeOperators, DataKinds, PolyKinds, MultiParamTypeClasses, FlexibleInstances, TypeFamilies, DoRec, ExtendedDefaultRules #-} | |
import Control.Applicative | |
import Control.Category | |
import Control.Comonad | |
import Control.Monad.Fix | |
import Control.Monad (ap) | |
import Data.Functor.Identity | |
import Data.Typeable | |
import Data.Monoid | |
import Data.Unique |
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
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE Rank2Types #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
import Control.Applicative | |
import Control.Arrow | |
import Control.Category |
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
{-# LANGUAGE RankNTypes, GADTs, PolyKinds #-} | |
module Tarjan where | |
import Control.Applicative | |
import Control.Category | |
import Data.Monoid | |
import Prelude hiding ((.),id) | |
-- Radu Mihaesau and Robert Tarjan's Catenable Deque |
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
;; | |
;; NS CHEATSHEET | |
;; | |
;; * :require makes functions available with a namespace prefix | |
;; and optionally can refer functions to the current ns. | |
;; | |
;; * :import refers Java classes to the current namespace. | |
;; | |
;; * :refer-clojure affects availability of built-in (clojure.core) | |
;; functions. |
As compiled by Kevin Wright a.k.a @thecoda
(executive producer of the movie, and I didn't even know it... clever huh?)
please, please, please - If you know of any slides/code/whatever not on here, then ping me on twitter or comment this Gist!
This gist will be updated as and when I find new information. So it's probably best not to fork it, or you'll miss the updates!
Monday June 16th
NewerOlder