Skip to content

Instantly share code, notes, and snippets.

<link href="http://fonts.googleapis.com/css?family=Droid+Serif:400,400italic,700,700italic" rel="stylesheet" type="text/css">
<!--[if IE]>
<link href="http://fonts.googleapis.com/css?family=Droid+Serif" rel="stylesheet" type="text/css">
<link href="http://fonts.googleapis.com/css?family=Droid+Serif:400italic" rel="stylesheet" type="text/css">
<link href="http://fonts.googleapis.com/css?family=Droid+Serif:700" rel="stylesheet" type="text/css">
<link href="http://fonts.googleapis.com/css?family=Droid+Serif:700italic" rel="stylesheet" type="text/css">
<![endif]-->
@amboy00
amboy00 / watch.sh
Created February 17, 2014 16:12
Easy way to use Sass in the CLI and output a map file at the same time.
sass --compass --sourcemap --watch sass/swa.scss:css/swa.css
@amboy00
amboy00 / grid.css
Created March 6, 2014 22:27
Sets a nice blue line every 20 pixels
div {
background-image: -webkit-linear-gradient(top, rgba(0,0,0,0) 95%, rgba(56,255,255,.8) 100%);
background-size: 100% 20px;
background-position: 10px 0px;
}
function listToMatrix(list, elementsPerSubArray) {
var matrix = [], i, k;
for (i = 0, k = -1; i < list.length; i++) {
if (i % elementsPerSubArray === 0) {
k++;
matrix[k] = [];
}
matrix[k].push(list[i]);

Keybase proof

I hereby claim:

  • I am amboy00 on github.
  • I am martinilab (https://keybase.io/martinilab) on keybase.
  • I have a public key whose fingerprint is E296 376A 05EB 8C2D AD3D 5863 4EBF 3805 FDF0 8127

To claim this, I am signing this object:

<div class="dropdown-wrapper">
<a href="#" class="has-dropdown" data-bind="dropdown: {}, text: someObservable"></a>
<div class="dropdown">
<div class="options" data-bind="foreach: list">
<div><a href="#" data-bind="text: $data, click: function() { $root.doThisFunction($data) }"></a></div>
</div>
</div>
@amboy00
amboy00 / myScriptyStuff.js
Last active August 29, 2015 13:58
One way to use RWD in JS.
jQuery(function ($) {
var width = window.innerWidth ? window.innerWidth : $(window).width(),
height = window.innerHeight ? window.innerHeight : $(window).height(),
touch = Modernizr.touch;
var breakpoint = function() {
if (width < 768) {
return 'small';
} else if (width < 992 ) {
<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">
@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();
}
});
}
@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