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
>>> x = '0123456789' | |
>>> a, b = [{} for _ in x], [{}] * len(x) | |
>>> a[0]['test'], b[0]['test'] = 1, 1 | |
>>> p(a) | |
[{'test': 1}, {}, {}, {}, {}, {}, {}, {}, {}, {}] | |
>>> p(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
# Discard local changes | |
git checkout -f (git co -f) | |
# This will change the current parent revision if you're not at a branch tip. | |
# The fact that it discards local changes is just a side effect. | |
hg update --clean (hg co -C) | |
# What you really want is the command *designed* to throw away changes: revert. | |
hg revert --all [--no-backup] (hg rev -a) |
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 bash | |
# cd to the root of the current Mercurial repo | |
# | |
# usage: | |
# Add the following function to your `.bashrc` or `.bash_profile` file, | |
# or save it somewhere (i.e. `~/.cdg.sh`) and source it in `.bashrc` | |
cdh () { | |
hg root >/dev/null && cd "`hg root`" |
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
#!/bin/bash | |
# Plant rope vim's plugin | |
# This is a script to install or update 'ropevim' | |
# Copyright Alexander Artemenko, 2008 | |
# Contact me at svetlyak.40wt at gmail com | |
function create_dirs | |
{ | |
mkdir -p src |
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 jquerytest.core) | |
(def jquery (js* "$")) | |
; Can you not use the short form? | |
(jquery | |
(fn [] | |
(-> (jquery "div.meat") | |
(.html "This is a test.") | |
(.append "<div>Look here!</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
unisubs.streamer.StreamBox.prototype.transcriptScrolled_ = function(e) { | |
if (this.videoScrolling_) { | |
this.videoScrolling_ = false; | |
} else { | |
this.showResyncButton_(true); | |
this.ignoreVideoScrolling_ = true; | |
} | |
}; | |
unisubs.streamer.StreamBox.prototype.scrollIntoView_ = function(streamSub) { |
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
(defn ^:export prependChild | |
[parent node] | |
(dom/insertChildAt parent node 0)) |
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 http = require('http') | |
var fork = require('child_process').fork; | |
function fib(n) { | |
if (n < 2) { | |
return 1; | |
} else { | |
return fib(n - 2) + fib(n - 1); | |
} | |
} |
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
(defmacro defrec [name args & body] | |
(let [indexed-args (interleave (iterate inc 0) args)] | |
`(defrecord ~name ~args | |
clojure.lang.Indexed | |
(nth [_# i#] | |
(case i# | |
~@indexed-args | |
(throw (IndexOutOfBoundsException.)))) | |
(nth [_# i# default#] | |
(case i# |
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
ehazlett sjl: hey have a sec? | |
sjl ehazlett: sure | |
ehazlett sjl: i'm trying to migrate the old testdata instance to the latest production | |
sjl ok | |
ehazlett sjl: when i try to migrate i'm getting the "ghost migrations" error | |
sjl fun | |
ehazlett sjl: http://d.pr/i/k7N | |
ehazlett sjl: sorry for the terrible formatting | |
sjl ehazlett: what exactly are you trying to do again? | |
sjl the production branch doesn't have team migrations 16+ |
OlderNewer