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 | |
# Inspired by http://dev.ghost.org/prevent-master-push/ | |
# Add this script to the following path in your local git repo: | |
# .git/hooks/pre-push | |
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,') | |
if [ 'master' = $current_branch ] || [ 'staging' = $current_branch ] || [ 'production' = $current_branch ] |
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
db.getCollectionNames().forEach(function(collection) { | |
if (!db[collection].find({ updated_at: { $exists: true }}).count()) { | |
print(collection + " collection does not have an updated_at field.") | |
} | |
}); |
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
attrs = { a: true, b: true, c: false, d: true, e: false } | |
_.each attrs, (val, key) => | |
console.log(key, val) | |
@[key] = val | |
# a true | |
# b true | |
# c false |
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
$ colorguard --file application.css | |
Collision: #f7931d, #f89406 | |
- #f7931d (#f7931d) [line: 148:14, 153:9] is too close (1.5127833911624) to #f89406 (#f89406) [line: 6015:76, 6016:58, 6017:48] | |
Collision: #00b4a4, #00b2a3 | |
- #00b4a4 (#00b4a4) [line: 198:14, 203:9, 6620:14, 7055:12, 7058:14] is too close (0.6324791268300444) to #00b2a3 (#00b2a3) [line: 4804:20, 4812:20, 7191:20] | |
Collision: #00b4a4, #00b5a5 | |
- #00b4a4 (#00b4a4) [line: 198:14, 203:9, 6620:14, 7055:12, 7058:14] is too close (0.28205982868491664) to rgba(0, 181, 165, 0.8) (#00b5a5) [line: 7070:14] |
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
@mixin fade-in-out($duration: 0.6s, $ease: ease-out, $delay: 0s) { | |
opacity: 0; | |
transition: visibility 0s $ease ($duration + $delay), opacity $duration $ease $delay; | |
visibility: hidden; | |
&.visible { | |
opacity: 1; | |
transition-delay: 0s; | |
visibility: visible; | |
} | |
} |
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
require 'benchmark' | |
iterations = 1_000_000 | |
def rename(source, dest) | |
{ source: source, dest: dest } | |
end | |
Benchmark.bm do |bm| |
This file has been truncated, but you can view the full file.
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
[ | |
"bawk", | |
"bagawk", | |
"a", | |
"aa", | |
"aah", | |
"aahed", | |
"aahing", | |
"aahs", | |
"aal", |
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
# To run the script: | |
# 1. Download caesar_cipher.rb | |
# 2. Download dictionary.json to the same directory (https://gist.githubusercontent.com/nickcherryjiggz/a615b4a39abedb84c50f/raw/3a8cec1c61cc6431bb84bdca19cab5ffb758ab8e/dictionary.json) | |
# 3. Open your terminal | |
# 4. Navigate to the directory where caesar_cipher.rb and dictionary.json live | |
# 5. Run the following command: ruby caesar_cipher.rb | |
require 'json' # We'll need this to parse the dictionary. | |
require 'open-uri' # We'll need this to fetch the dictionary from Github, if it's not available locally. |
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
angular.module 'angular-custom-select-examples', ['angular-custom-select'] | |
.controller 'ExamplesController', ($scope) -> | |
$scope.selectedValues = {} | |
$scope.objects = [ | |
{ name: 'Option A' } | |
, { name: 'Option B' } | |
, { name: 'Option C' } | |
, { name: 'Option D (disabled)', disabled: true } |
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
angular.module 'angular-custom-select-examples', ['angular-custom-select'] | |
.controller 'ExamplesController', ($scope) -> | |
$scope.selectedValues = {} | |
$scope.strings = ['Option A', 'Option B', 'Option C', 'Option D', 'Option E'] |