Skip to content

Instantly share code, notes, and snippets.

'use strict';
var KuduApp = require('./KuduApp');
var React = require('react');
var Router = require('react-router');
var Route = Router.Route;
var Routes = (
<Route handler={KuduApp}>
(setq kudu-path (concat HOME "projects/kudu/kudu/src/components/*\\.js[x]?"))
(add-to-list 'auto-mode-alist `(,kudu-path . web-mode))
(setq web-mode-content-types-alist
`(("jsx" . ,kudu-path)))
@mattdeboard
mattdeboard / release.py
Created June 9, 2015 20:44
Script for automated version tagging & changelog updates.
#!/usr/bin/env python
"""This script generates release notes for each merged pull request from
git merge-commit messages.
Usage:
`python release.py <start_commit> <end_commit> [--output {file,stdout}]`
For example, if you wanted to find the diff between version 1.0 and 1.2,
and write the output to the release notes file, you would type the
following:
`python release.py 1.0 1.2 -o file`
"""
def concat_while(s0, s1):
"""
Concatenate s0 and s1 with a space if the length of that concatenation
is less than or equal to 30 characters. Otherwise it just returns s0.
"""
if len(s0) > 30:
return s0[:30]
new = ' '.join([s0, s1])
("case" non-block-expr "do" match-statements "end"))
read machine_id </var/lib/dbus/machine-id
dbus-launch --autolaunch="$machine_id" --binary-syntax --close-stderr --exit-with-session
if [ -f "$HOME/.dbus/session-bus/$machine_id-${DISPLAY#:}" ]; then
. "$HOME/.dbus/session-bus/$machine_id-${DISPLAY#:}"
unset machine_id
printf '%s\n' "$DBUS_SESSION_BUS_ADDRESS" > "$HOME/.dbus_address"
fi
renderResultRows: function*() {
const results = this.state.results;
for (var result in results) {
yield <SearchResult {...result} />
}
},
// return results.map(function(result) {
// return (
// <SearchResult {...result} />
// );
struct FizzBuzzinificationator {
vals: std::iter::Range<int>
}
impl FizzBuzzinificationator {
fn fizzbuzzmaybe (&self, x: int) -> &'static str {
if x % 3i == 0i && x % 5i == 0i { "FizzBuzz" }
else if x % 3i == 0i { "Fizz" }
else if x % 5i == 0i { "Buzz" }
else { "" }
fn fizzbuzzinator (x: int) -> &'static str {
if x % 3i == 0i && x % 5i == 0i { "FizzBuzz" }
else if x % 3i == 0i { "Fizz" }
else if x % 5i == 0i { "Buzz" }
else { "" }
}
fn main() {
for i in range(0i, 100i) {
let val: &str = fizzbuzzinator(i);
@mattdeboard
mattdeboard / atom.coffee
Last active August 29, 2015 14:08
Toying with protocols in CoffeeScript
cloneState = (state, phase = 'current') ->
###
Returns a copy of a particular phase (i.e. either current or initial)
of the atom state.
Of course this assumes everything in the value is serializable to
JSON :)
###
JSON.parse(JSON.stringify(state[phase]))