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'; | |
| Ember.run.schedule('actions', () => { | |
| document.writeln(1); | |
| }); | |
| Ember.run.join(() => { | |
| Ember.run.schedule('actions', () => { | |
| document.writeln(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
| def random_array(size) | |
| Array.new(size) { rand(size) } | |
| end | |
| def bubble_sort(array) | |
| array.size.times do | |
| array[0..-2].each_index do |i| | |
| array[i], array[i + 1] = array[i + 1], array[i] if array[i] > array[i + 1] | |
| 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
| { | |
| "credentials": { | |
| "expires": true, | |
| "expires_at": 1436019773, | |
| "refresh_token": "[hidden]", | |
| "token": "[hidden]" | |
| }, | |
| "extra": { | |
| "raw_info": { | |
| "city": "Xi'an", |
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
| h = { | |
| foo: { | |
| bar: { | |
| baz: 1 | |
| }, | |
| oof: { | |
| zab: 2 | |
| } | |
| }, | |
| zha: { |
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
| # Resolving internal domains | |
| local-zone: "local." static | |
| local-data: "example.local. IN A [Internal Server IP]" | |
| # Stub out CDN domains to use local DNS provided by your ISP | |
| stub-zone: | |
| name: "akadns.net" | |
| stub-addr: [Local DNS IP] |
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
| @echo off | |
| mpv --profile=theater %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
| class ChessBoard | |
| attr_accessor :rows, :columns, :square_size | |
| def initialize(rows, columns, square_size) | |
| @rows = rows | |
| @columns = columns | |
| @square_size = square_size | |
| end | |
| def render |
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
| def recursive_letters(letters, depth = 0) | |
| character = letters.shift | |
| indentation = ' ' * depth | |
| puts "#{indentation}<#{character}>" | |
| recursive_letters(letters, depth + 1) unless letters.empty? | |
| puts "#{indentation}</#{character}>" | |
| 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
| require 'securerandom' | |
| class PasswordGen | |
| ALPHANUMERIC = ((48..57).to_a + (65..90).to_a + (97..122).to_a).pack('c*').freeze | |
| SYMBOL = ((33..47).to_a + (58..64).to_a + (91..96).to_a + (123..126).to_a).pack('c*').freeze | |
| attr_reader :length, :alphanumeric, :symbol | |
| def initialize(length: 20, alphanumeric: true, symbol: true) | |
| @length = length.to_i |
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
| # requires recycle-bin: https://github.com/sindresorhus/recycle-bin | |
| orphan_files = Dir.glob('*.JPG').reject do |jpg_file| | |
| File.exist? "#{File.basename(jpg_file, '.*')}.CR2" | |
| end | |
| puts "Removing #{orphan_files.size} orphan files: " | |
| orphan_files_join = orphan_files.join(' ') | |
| puts orphan_files_join | |
| exec "recycle-bin #{orphan_files_join}" |