Skip to content

Instantly share code, notes, and snippets.

View nickcherry's full-sized avatar

Nick Cherry nickcherry

View GitHub Profile
@nickcherry
nickcherry / product.coffee
Last active August 29, 2015 14:05
Product Availability
angular.module('JCP').factory 'Product', ($resource, Config) ->
$resource "#{ Config.BASE_API_URL }/products/:id", {},
getAvailability:
method: 'GET'
url: "#{ Config.BASE_API_URL }/products/:id/availability"
isArray: true
@nickcherry
nickcherry / sample-audio-sample.js
Last active August 29, 2015 14:06
Sample Audio Sample
{
"0": -0.2168882191181183,
"1": -0.18157310783863068,
"2": -0.10816243290901184,
"3": -0.044059522449970245,
"4": -0.04719730466604233,
"5": -0.12277217954397202,
"6": -0.20372386276721954,
"7": -0.20472729206085205,
"8": -0.10176539421081543,
@nickcherry
nickcherry / gulpfile.js
Last active August 29, 2015 14:06
digital-platform-uglification
/********************************************************************/
/* Imports */
/********************************************************************/
var Gulp = require('gulp');
var Concat = require('gulp-concat');
var Uglify = require('gulp-uglify');
/********************************************************************/
@nickcherry
nickcherry / controller.coffee
Last active April 26, 2017 00:00
custom-angular-select (array of strings)
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']
@nickcherry
nickcherry / controller.coffee
Last active April 26, 2017 00:00
custom-angular-select (array of objects)
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 }
@nickcherry
nickcherry / caesar_cipher.rb
Last active August 29, 2015 14:12
Caesar Cipher
# 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.
@nickcherry
nickcherry / dictionary.json
Created January 4, 2015 17:37
Dictionary
This file has been truncated, but you can view the full file.
[
"bawk",
"bagawk",
"a",
"aa",
"aah",
"aahed",
"aahing",
"aahs",
"aal",
require 'benchmark'
iterations = 1_000_000
def rename(source, dest)
{ source: source, dest: dest }
end
Benchmark.bm do |bm|
@nickcherry
nickcherry / chained-transitions.scss
Created April 1, 2015 14:08
Chained Transition
@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;
}
}
@nickcherry
nickcherry / application.css.txt
Last active August 29, 2015 14:18
Colorguard
$ 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]