Skip to content

Instantly share code, notes, and snippets.

View automagisch's full-sized avatar

Koen Houtman automagisch

View GitHub Profile
@automagisch
automagisch / 0_reuse_code.js
Last active August 29, 2015 14:19
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@automagisch
automagisch / n-btn-.html
Last active August 29, 2015 14:19
TWBS workaround for justified btn group with native buttons
<div class="n-btn-group">
<div class="col-xs-4 n-btn">
<button type="submit" class="btn btn-success">Save</button>
</div>
<div class="col-xs-4 n-btn">
<button class="btn btn-warning">Reset</button>
</div>
<div class="col-xs-4 n-btn">
<button class="btn btn-danger">Delete</button>
</div>
@automagisch
automagisch / DateSelectionView.js
Created June 23, 2015 08:19
Basic Ember Date Selector
App.DateSelectionView = Em.View.extend({
templateName: "date-selection",
tagName: "div",
classNames: ['date-selector','clearfix'],
classNameBindings: ['showLabels::no-labels'],
date: null,
showLabels: true,
timezone: true,
@automagisch
automagisch / LocalStorageHandler.js
Created June 25, 2015 09:54
This is a very minimalistic interface on top of the LocalStorage API to save key-value objects as one value to LocalStorage. Done a lot of times, but this one just does the most simplest of things. Quick, easy and safe :)
var LS = function() {
/*
LocalStorageHandler Class
- emulates a more user friendly interface
for the LocalStorage API
*/
var LocalStorageHandler = function() {
this.key = "local";
@automagisch
automagisch / form-reset-helpers.scss
Created May 2, 2016 10:14 — forked from mjlescano/form-reset-helpers.scss
Reset for form elements written in SCSS
/* ----------------------------------------------------------------------------------------------------
SCSS Form Reset Helpers - Forked from: https://gist.github.com/anthonyshort/552543
Intended usage:
- MIXINS: for very specific use cases, when you dont want to reset absolutly all the forms, very verbose output.
- PLACEHOLDER SELECTORS: use as extending classes. Less verbose, more generic overrides.
A couple of things to watch out for:
@automagisch
automagisch / polyfill.js
Created May 3, 2016 15:30 — forked from gerred/polyfill.js
Canvas Polyfill
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame']
|| window[vendors[x]+'CancelRequestAnimationFrame'];
}
if (!window.requestAnimationFrame)
@automagisch
automagisch / jqueryutils.form-parser.js
Last active May 24, 2016 12:53
jQuery form field parser with support for radio's and checkboxes
/*
* jQuery utilities
* Takes in a form element and rips out all the values in a simple key-value pair
*/
$(function() {
$.fn.parseFormFields = function(props) {
// define some default settings with default values
@automagisch
automagisch / parseHeaderString.js
Created February 28, 2017 11:05
Parse a header string to a key-value format wrapped in an Array
/*
@description A function that takes in some headers as a string containing newlines.
It will split the string on its newlines, and then will split it into
a key-value pair for easy deploying into HTML.
@param headerStr [String]
@returns headers [Array]
*/
function parseHeaderString(headerStr) {
@automagisch
automagisch / color-management.scss
Last active June 9, 2017 12:30
Automated SCSS Color Management
/*
defines base colors, all colors to use are described in this map.
works pretty well with a color palette generator like http://coolors.co/
palette in this example: https://coolors.co/def200-242038-315659-e3efeb-028090
MAP ui-colors (
[STRING] color-name: [HEX] hex-value
)
*/
/*
SASS Class helpers
to make these work, include them in some imported file (like variables.scss or mixins.scss) and
extend them on classes like so:
ul {
@extend %reset-list;
}