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 | |
# | |
# iterm2-badge.sh | |
# | |
# Send escape sequences so that iterm2 can set the badge to arbitrary text | |
# | |
# https://www.iterm2.com/documentation-badges.html | |
# | |
function iterm2_print_user_vars() { |
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
""" | |
A 2x3 rectangle is divided into 6 squares A, B, C, D, E, and F. | |
I represent the painted 2x3 array as a list of six items, for easier indexing | |
+---+---+---+ | |
| A | B | C | | |
+---+---+---+ => [A, B, C, D, E, F] | |
| D | E | F | | |
+---+---+---+ |
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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
divs: Array.from(Array(100).keys()) | |
}); |
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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
remodal: Ember.inject.service(), | |
name: 'Name', | |
actions: { | |
rename (name) { | |
this.set('name', name) |
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
# | |
# demo_attrs | |
# | |
import attr | |
@attr.s | |
class Foo(object): | |
x = attr.ib() |
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
# paste directly into console | |
In [2]: class Sample: | |
...: | |
...: def __init__(self): | |
...: print('hehe') | |
...: | |
In [3]: s = Sample() | |
hehe |
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/sh | |
# | |
# alias flip='echo "(╯°□°)╯︵ ┻━┻"' | |
# | |
# requires `pip install upsidedown` | |
# | |
prefix='(╯°□°)╯︵' | |
flipped='┻━┻' |
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
// Saved as a bookmark: | |
// (which apparently only works in Chrome) | |
javascript:(function (){ var newcss = ".container { width: 100%; } .repository-with-sidebar .repository-content { width: -moz-calc(100% - 90px); width: -webkit-calc(100% - 90px); width: calc(100% - 90px); }"; if ("\v" == "v") { document.createStyleSheet().cssText = newcss } else { var tag = document.createElement("style"); tag.type = "text/css"; document.getElementsByTagName("head")[0].appendChild(tag); tag[(typeof document.body.style.WebkitAppearance == "string") ? "innerText" : "innerHTML"] = newcss; }})(); | |
// beautified with js-beautify: | |
javascript: (function() { | |
var newcss = ".container { width: 100%; } .repository-with-sidebar .repository-content { width: -moz-calc(100% - 90px); width: -webkit-calc(100% - 90px); width: calc(100% - 90px); }"; | |
if ("\v" == "v") { | |
document.createStyleSheet().cssText = newcss | |
} else { |
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/perl | |
# | |
# spaces-to-tabs-filter | |
# | |
# A simple regex example | |
# perl -e 'while (<>) { $line = $_; $line =~ s/ /\t/g; print $line; }' < foo_spaces.py > foo_tabs.py | |
# | |
while (<>) { |