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.
| require 'base64' | |
| require 'cgi' | |
| def show_session(cookie) | |
| Marshal.load(Base64.decode64(CGI.unescape(cookie.split("\n").join).split('--').first)) | |
| end |
| CREATE TABLE accounts( | |
| id serial PRIMARY KEY, | |
| name VARCHAR(256) NOT NULL | |
| ); | |
| CREATE TABLE entries( | |
| id serial PRIMARY KEY, | |
| description VARCHAR(1024) NOT NULL, | |
| amount NUMERIC(20, 2) NOT NULL CHECK (amount > 0.0), | |
| -- Every entry is a credit to one account... |
| git archive --format=tar origin/master | gzip -9c | ssh user@yourserver.com "cd /var/www; tar xvzf -" |
A lot of these are outright stolen from Edward O'Campo-Gooding's list of questions. I really like his list.
I'm having some trouble paring this down to a manageable list of questions -- I realistically want to know all of these things before starting to work at a company, but it's a lot to ask all at once. My current game plan is to pick 6 before an interview and ask those.
I'd love comments and suggestions about any of these.
I've found questions like "do you have smart people? Can I learn a lot at your company?" to be basically totally useless -- everybody will say "yeah, definitely!" and it's hard to learn anything from them. So I'm trying to make all of these questions pretty concrete -- if a team doesn't have an issue tracker, they don't have an issue tracker.
I'm also mostly not asking about principles, but the way things are -- not "do you think code review is important?", but "Does all code get reviewed?".
| BEGIN { | |
| int visited[node_t]; | |
| int visit(node_t n, edge_t e) { | |
| if (visited[n] == 0) { | |
| visited[n] = 1; | |
| for (e = fstin(n); e; e = nxtin(e)) { | |
| visit(e.tail, NULL); | |
| } |
| ;;By Jhen Kung, ryankung@ieee.org | |
| ;;app.rkt | |
| #lang racket(require web-server/servlet | |
| web-server/servlet-env | |
| "router.rkt") | |
| (serve/servlet mordor | |
| #:port 8080 | |
| #:servlet-path "/" |
| require 'rubygems' | |
| require 'pg' | |
| require 'eventmachine' | |
| module Subscriber | |
| def initialize(pg) | |
| @pg = pg | |
| end | |
| def notify_readable |
| AllCops: | |
| RunRailsCops: true | |
| # Commonly used screens these days easily fit more than 80 characters. | |
| Metrics/LineLength: | |
| Max: 120 | |
| # Too short methods lead to extraction of single-use methods, which can make | |
| # the code easier to read (by naming things), but can also clutter the class | |
| Metrics/MethodLength: |
| require "rspec/autorun" | |
| class Enumerator::Lazy | |
| def reduce(*) | |
| Lazy.new([nil]) do |yielder, _| | |
| yielder << super | |
| end | |
| end | |
| def join(separator="") |