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
#!/usr/bin/env ruby | |
# Usage | |
# $ docker-machine create my-machine123 -d virtualbox | |
# $ ruby <(curl -L https://git.io/vvvco) my-machine123 | |
# https://gist.github.com/mattes/4d7f435d759ca2581347 | |
require 'erb' | |
bootlocalsh = %Q(#/bin/bash |
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
koans: | |
image: clojure | |
command: lein koan run | |
volumes: | |
- ./clojure-koans:/clojure-koans | |
working_dir: /clojure-koans | |
repl: | |
image: clojure | |
command: lein repl |
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
require 'active_record' | |
require 'hotch' | |
ActiveRecord::Base.establish_connection('postgresql://localhost/rom') | |
class User < ActiveRecord::Base | |
end | |
User.delete_all |
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
var Game = React.createClass({ | |
getInitialState: function() { | |
var numbers = _.shuffle(_.range(1, this.props.size * this.props.size)); | |
var table = []; | |
var thumb_position = {}; | |
for (var x = 0; x < this.props.size; x++) { | |
table[x] = []; | |
for (var y = 0; y < this.props.size; y++) { | |
if (x == this.props.size - 1 && y == this.props.size - 1) { | |
thumb_position = {"x": x, "y": y}; |
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
mv ~/Library/Application\ Support/Skype ~/Dropbox/ | |
ln -s ~/Dropbox/Skype ~/Library/Application\ Support/Skype |
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
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
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
background do | |
set_omniauth() | |
click_link_or_button 'Sign up with Facebook' | |
end |
NewerOlder