Skip to content

Instantly share code, notes, and snippets.

View ste2425's full-sized avatar

Stephen Cooper ste2425

View GitHub Profile
@ste2425
ste2425 / vendorPrefix.scss
Created July 21, 2016 09:03
Vender prefix utility
@mixin vendorPrefix($prop, $val) {
-webkit-#{$prop}: $val;
-moz-#{$prop}: $val;
-ms-#{$prop}: $val;
-o-#{$prop}: $val;
#{$prop}: $val;
}
/*
Use:
@ste2425
ste2425 / _grid.scss
Created July 20, 2016 14:35
response grid layout
/*
Variables:
$screen-size-small
$screen-size-medium
$screen-size-large
$grid-small-screen-width
$grid-medium-screen-width
$grid-large-screen-width
@ste2425
ste2425 / group.js
Created July 15, 2016 15:18
Simple JavaScript Group
"use strict";
let group = (arr, by) => arr.reduce((prev, cur) => {
let val = isFunction(by) ? by(cur) : cur[by];
prev.hasOwnProperty(val) ? prev[val].push(cur) : prev[val] = [cur];
return prev;
}, {}),
isFunction = (x) => Object.prototype.toString.call(x) === "[object Function]";
module.exports = () => ({group, isFunction});
@ste2425
ste2425 / uart.c
Created May 17, 2016 19:09
flawed uart for pic. It resets.
#define _XTAL_FREQ 4000000
#include <pic16f688.h>
#include <xc.h>
// CONFIG
#pragma config FOSC = INTOSCIO // Oscillator Selection bits (INTOSC oscillator: CLKOUT function on RA4/OSC2/CLKOUT pin, I/O function on RA5/OSC1/CLKIN)
#pragma config WDTE = ON // Watchdog Timer Enable bit (WDT enabled)
#pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT disabled)
#pragma config MCLRE = ON // MCLR Pin Function Select bit (MCLR pin function is MCLR)
#pragma config CP = OFF // Code Protection bit (Program memory code protection is disabled)
@ste2425
ste2425 / click.js
Created February 19, 2016 10:47
Click handler that will not fire if element is disabled. (anchor tags)
/*
Will call your click handler if the element is not disabled.
Usefull for legacy apps where elements such as anchor tags are used.
As these do not respect the disabled attribute.
Does not matter how element is disabled, angular, jQuery native or even devTools.
Should strongly consider using it outside the `ng` namesapce.
*/