Skip to content

Instantly share code, notes, and snippets.

View edwinwebb's full-sized avatar

Edwin Webb edwinwebb

View GitHub Profile
@edwinwebb
edwinwebb / RalCodes.json
Last active February 26, 2023 13:51
EU RAL Color Codes lookup table represented as JSON
{
"1000":{
"code":"1000",
"name":"Green beige",
"rgb":"205-186-136",
"hex":"#CDBA88"
},
"1001":{
"code":"1001",
"name":"Beige",
@edwinwebb
edwinwebb / gist:5151220
Created March 13, 2013 11:21
Format MS to Time Stamp "MM:SS:XX" in Javascript
function formatSeconds(seconds, format) {
var ms = Math.floor((seconds*1000) % 1000);
var s = Math.floor(seconds%60);
var m = Math.floor((seconds*1000/(1000*60))%60);
var strFormat = format || "MM:SS:XX";
if(s < 10) s = "0" + s;
if(m < 10) m = "0" + m;
if(ms < 10) ms = "0" + ms;
@edwinwebb
edwinwebb / SanFrancisco.Neighborhoods.json
Created August 28, 2019 16:20 — forked from cdolek/SanFrancisco.Neighborhoods.json
San Francisco Neighborhoods GeoJson with Zipcodes
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@edwinwebb
edwinwebb / gist:5155504
Last active February 1, 2019 15:39
A simple less loop with comments and simple from, to syntax.
/* Define two variables as the loop limits */
@from : 0;
@to : 10;
/* Create a Parametric mixin and add a guard operation */
.loop(@index) when(@index =< @to) {
/* As the mixin is called CSS is outputted */
div:nth-child(@{index}) {
top: unit(@index * 100, px);
@edwinwebb
edwinwebb / pixi blendmodes
Created May 19, 2015 08:29
PIXI.js Blend Modes
{
"NORMAL": 0,
"ADD": 1,
"MULTIPLY": 2,
"SCREEN": 3,
"OVERLAY": 4,
"DARKEN": 5,
"LIGHTEN": 6,
"COLOR_DODGE": 7,
"COLOR_BURN": 8,
@edwinwebb
edwinwebb / css-cdn-js
Created February 1, 2018 05:17
load css from cdn with javascript
const CSSURL = '//cdn.rawgit.com/milligram/milligram/master/dist/milligram.min.css'
const style = document.createElement('link');
style.setAttribute('href', CSSURL);
style.setAttribute('rel', 'stylesheet');
document.body.appendChild(style);
@edwinwebb
edwinwebb / secondsToTimeString
Created November 18, 2011 16:07
Javascript Media Seconds to MM:SS:MS string
secondsToTimeString = function (seconds) {
var ms = Math.floor((seconds*1000) % 1000);
var s = Math.floor(seconds%60);
var m = Math.floor((seconds*1000/(1000*60))%60);
var strFormat = "MM:SS:XX";
if(s < 10) s = "0" + s;
if(m < 10) m = "0" + m;
if(ms < 10) ms = "0" + ms;
As a user
I want to Sign-Up
So that can use the App to it's fullest
Given I have an email address
And agree to the PP and TnC
When the form is valid and submitted
Then an email is sent
And the activation code is presented
Then the link is clicked
@edwinwebb
edwinwebb / bitcolor.js
Created September 5, 2016 11:54 — forked from lrvick/bitcolor.js
Javascript functions for doing fast binary/hex/RGB color conversions using bitwise operations.
// convert 0..255 R,G,B values to binary string
RGBToBin = function(r,g,b){
var bin = r << 16 | g << 8 | b;
return (function(h){
return new Array(25-h.length).join("0")+h
})(bin.toString(2))
}
// convert 0..255 R,G,B values to a hexidecimal color string
RGBToHex = function(r,g,b){
@edwinwebb
edwinwebb / jquery.number.animation.js
Created March 13, 2013 08:51
Animate numbers with JQuery animate. Useful for animating updates to numbers.
jQuery.Animation(
{'test' : 0}, // 'element'
{'test' : 100}, // match props in 'element'
{
duration:100, //standard options
step : function(a) {
console.log(a); //step
}
}
);