Skip to content

Instantly share code, notes, and snippets.

@amboy00
amboy00 / say-youll-be-there.js
Created June 23, 2017 16:56
compare to arrays of objects, return only the difference
// Finding the difference between to arrays of objects
// As told through the magic of...
// _____ _ _____ _ _
// / ____| (_) / ____(_) | |
// | (___ _ __ _ ___ ___ | | __ _ _ __| |___
// \___ \| '_ \| |/ __/ _ \ | | |_ | | '__| / __|
// ____) | |_) | | (_| __/ | |__| | | | | \__ \
// |_____/| .__/|_|\___\___| \_____|_|_| |_|___/
// | |
// |_|
# Start the docker daemon without having to click that obnoxious icon.
alias docker-start="/Applications/Docker/Docker\ Quickstart\ Terminal.app/Contents/Resources/Scripts/start.sh"
@amboy00
amboy00 / employee.js
Created August 21, 2015 22:40
When I run this test, it fails - Employee Module should get Employee by ID: timeout of 2000ms exceeded. Ensure the done() callback is being called in this test.
var Employee = function() {
var loadUserinfo = function(userid) {
return $.ajax({
type: 'GET',
data:{userid: userid},
url: '/employees.json',
dataType: 'json',
async: true,
success: function(data) {
@amboy00
amboy00 / _nav.scss
Created May 15, 2015 14:30
Change the css class after a scrolled threshold. CSS has a background change.
nav#main {
position: fixed;
z-index: 200;
top: 0;
left: 0;
width: 100%;
background: rgba(255, 255, 255, 0.01);
transition: all 0.3s ease;
&.opaque {
@amboy00
amboy00 / Markdown.sublime-settings
Created April 10, 2015 23:48
My Markdown syntax specific settings.
{
"extensions":
[
"md"
],
// "line_numbers": false,
// "gutter": false,
"draw_centered": true,
"wrap_width": 80,
@amboy00
amboy00 / load-models.js
Created December 30, 2014 21:10
There has to be a better way to load these files. Also, that . path and relative path stuff…
// load all files in models dir
fs.readdirSync( './models/' ).forEach( function( filename ) {
if ( ~filename.indexOf('.js')) {
require( '../models/' + filename);
}
console.log(filename);
});
#!/bin/bash
echo -en "\n + "
for i in {0..35}; do
printf "%2b " $i
done
printf "\n\n %3b " 0
@amboy00
amboy00 / 16_colors.sh
Created November 11, 2014 16:39
Cycles through the available colors in Terminal.app
#!/bin/bash
#Background
for clbg in {40..47} {100..107} 49 ; do
#Foreground
for clfg in {30..37} {90..97} 39 ; do
#Formatting
for attr in 0 1 2 4 5 7 ; do
#Print the result
@amboy00
amboy00 / no-bubble.js
Created April 17, 2014 11:31
Prevent bubbling in knockout
ko.bindingHandlers.noBubble = {
init: function(element, valueAccessor) {
var eventName = ko.utils.unwrapObservable(valueAccessor());
ko.utils.registerEventHandler(element, eventName, function(event) {
event.cancelBubble = true;
if (event.stopPropagation) {
event.stopPropagation();
}
});
}
<div class="input-row">
<a href="#" class="button tool">Go to today</a>
</div>
<div class="input-row white">
<div class="slider" data-bind="jqueryuiSlider: {}"></div>
</div>
<div class="input-row">
<div class="datepicker-input">