Skip to content

Instantly share code, notes, and snippets.

View paceaux's full-sized avatar
🌐
Obsessing with languagey things

Paceaux paceaux

🌐
Obsessing with languagey things
View GitHub Profile
@paceaux
paceaux / paceaux-storage-pattern
Last active December 16, 2015 19:19
A very basic JavaScript object that merges localStorage and sessionStorage, and allows you to store and retrieve either objects, arrays, or text strings as your values.
store = {
types: [localStorage,sessionStorage],
convertValue: function (v) {
return typeof v !== "object" ? v : JSON.stringify(v);
},
unconvertValue: function (v) {
if (v !== null) {
if ( v.indexOf("{") === 0 || v.indexOf("[") === 0 ) {
var v = JSON.parse(v);
return v;
@using System.IO
<style type="text/css">
table{color: #333; text-align: left; min-width: 400px; border-collapse: collapse; border:1px solid gray;}
th, td {padding: .618em}
thead th, thead td { font-size: 1.15em; border-bottom: 2px solid #494949; background: #f1f1f1}
tbody th, tbody td {border-bottom:1px solid #555}
tbody td:nth-child(2){}
caption{font-size: .95em}
.compInfo {color: #333}
@paceaux
paceaux / server.js
Created September 3, 2013 18:38
Nodejs webserver in under 40 lines
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs"),
port = 8891,
types = {
'html' : 'text/html',
'htm' : 'text/html',
'js' : 'application/javascript',
'css' : 'text/css'
@paceaux
paceaux / flex-tables
Last active December 24, 2015 12:09
all the core properties stylus to make an HTML table display with the CSS flex box module
table {
display: flex;
flex-direction: column;
align-items: stretch;
}
thead {
order: -1;
}
tbody {
flex-grow: 1;
@paceaux
paceaux / stylusfontconversions
Created October 2, 2013 16:16
Stylus font functions. Add this to a vars.styl file that you would import all over the place.
//========== root values
phi = 1.618
fi = .618
golden = 1.61803398875
rootPx = 16px
rootEm = 1em
rootPercent = 100%
rootPt = pxToPt(rootPx)
@paceaux
paceaux / CSSOM
Last active August 22, 2018 01:06
CSSOM debugger See the stylesheets and the rules in the stylesheets.
window.analyzer = {
init: function (object, id) {
this.functions.appendTable(id);
this.functions.setupHeaders(object);
this.functions.addData(object);
this.functions.addCaption("Analysis of the stylesheets");
},
data: {},
helpers: {
wrapper: function (id) {
@paceaux
paceaux / cssom.js
Last active December 26, 2015 13:29
Stylesheet toggler. Uses the CSSOM (Cascading StyleSheet Object Model). Drop this somewhere on your page and it'll find your stylesheets and let you turn them on and off.
window.cssom = {
init: function () {
var _this = window.cssom;
_this.functions.bootstrapTable();
},
data: {
table: {},
rootClass: "CSSOM",
tableClass: "table",
rowButton: {
@paceaux
paceaux / speaker.js
Last active August 29, 2015 13:55
Speech Synthesis JS API
speech = function (msg, options, onend) {
this.text = msg;
this._defaults = {
voiceURI: 'native',
volume: 3,
rate: 2,
pitch: 1.5,
lang: 'en-US'
};
this.defaults = options !== undefined ? options : this._defaults;
@paceaux
paceaux / mm.js
Created January 30, 2014 23:21
Media manager Module
var mediaManager = {};
mediaManager: {
init: function () {
var _this = this;
//MMPLAYERREADY is the event that fires when the media manager event loads
_this.functions.setMetadata($('.js-active'));
_this.bindUIEvents();
$(document).bind("MMPLAYERREADY", function (e){
_this.functions.adjustDimensions();
_this.functions.modifyProjekktor();
@paceaux
paceaux / needy.js
Last active August 29, 2015 13:57
Page Visibility + speech
var tabAway;
tabAway = {
init: function () {
var _this = tabAway;
_this.bindEvents();
},
data: {
tabAwayMsg: "Don't go, I need you!",
tabBackMsg: "I knew you'd never leave me",
},