This file contains hidden or 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', | |
| checkboxes: Ember.computed(function() { | |
| return Array.from({length: 4}, (x, i) => Ember.Object.create({checked: i >= 2})); | |
| }), | |
| checkboxesAsJson: Ember.computed('checkboxes.@each.checked', function() { | |
| return JSON.stringify(this.get('checkboxes'), null, 2); | |
| }) |
This file contains hidden or 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
| # cd to directory of dotfiles based on this script. | |
| $scriptDir = Split-Path $SCRIPT:MyInvocation.MyCommand.Path -Parent | |
| $dir = Resolve-Path (Join-Path $scriptDir "..") | |
| cd $dir | |
| function install($path) { | |
| $dir = Split-Path $Path | |
| $filename = (ls $path).Name | |
| if ($dir) { | |
| $prefix = Resolve-Path (Join-Path $HOME ".$dir") |
This file contains hidden or 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 python | |
| import sys | |
| import time | |
| def uchar(code): | |
| return ('\\U%08x' % code).decode('unicode-escape') | |
| start = 0x1F550 | |
| end = 0x1F55B | |
| emoji = map(uchar, range(start, end + 1)) |
This file contains hidden or 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 | |
| def spin | |
| ("\u{1F550}" .. "\u{1F55B}").cycle.each do |moji| | |
| print moji, " " | |
| sleep 0.1 | |
| print "\r" | |
| end | |
| end |
This file contains hidden or 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
| module MyDecorators | |
| def limit(max, name) | |
| tries = 0 | |
| m = instance_method(name) | |
| define_method(name) do |*args| | |
| tries += 1 | |
| if tries <= max | |
| m.bind(self).call(*args) | |
| else | |
| raise "LIMITER ENGAGED" |
This file contains hidden or 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
| const P = require('parsimmon'); | |
| const Chalk = require('chalk'); | |
| function wants(x) { | |
| process.stdout.write(Chalk.bold.red('( wants ' + Chalk.cyan(x) + ' ) ')); | |
| return x; | |
| } | |
| function got(x) { | |
| console.log(Chalk.bold.green('( GOT ' + Chalk.cyan(x) + ' )')); |
This file contains hidden or 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
| function fish_prompt | |
| set E | |
| set E $E \U1F51C # soon | |
| set E $E \U1F354 # hamburger | |
| set E $E \U1F4A9 # poo | |
| set E $E \U1F47A # tengu | |
| set E $E \U1F349 # watermelon | |
| set E $E \U1F300 # cyclone | |
| set E $E \U1F37A # beer | |
| set E $E \U1F382 # cake |
This file contains hidden or 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 util = require("util"); | |
| var P = require("parsimmon"); | |
| // Throw away whitespace surrounding a string. | |
| function operator(s) { | |
| return P.optWhitespace | |
| .then(P.string(s)) | |
| .skip(P.optWhitespace); | |
| } |
This file contains hidden or 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
| function fly(creature) { | |
| return ( | |
| "The " + creature.species + | |
| " flies using its " + creature.methodOfFlight | |
| ); | |
| } | |
| function hunt(creature, otherCreature) { | |
| return ( | |
| "The " + creature.species + |
This file contains hidden or 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
| export default [ | |
| "module1", | |
| "module2" | |
| ].map(x => System.import(x)).then(([ | |
| module1, | |
| module2 | |
| ])) => { | |
| return { | |
| myApi: whatever | |
| }; |