This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* author: andreas johan virkus | |
* snippet url: https://gist.github.com/andreasvirkus/917a47fd8276be57300e | |
* | |
* Return all classes found that match the given prefix | |
* Example: You have an element with classes "apple juiceSmall juiceBig banana" | |
* You run: | |
* $elem.returnClassPrefix('juiceS'); | |
* The resulting class is "juiceSmall" | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<!-- Remove link outlines only for mouse interactions, keeping the tab-friendly outline for disabled users and keyboard lovers --> | |
<html> | |
<head> | |
<style id="_outline-styles"></style> | |
</head> | |
<body onmousedown="document.getElementById('_outline-styles').innerHTML='a{outline:none}';" | |
onkeydown="document.getElementById('_outline-styles').innerHTML=''"> | |
<a href="#">test link</a> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The lighten/darken functionality of SASS and LESS preprocessors in JavaScript | |
// Courtesy of Chris Coyier (https://css-tricks.com/snippets/javascript/lighten-darken-color/) | |
function LightenDarkenColor(col, amt) { | |
var usePound = false; | |
if (col[0] == "#") { | |
col = col.slice(1); | |
usePound = true; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Basic static server setup with Node.js | |
var http = require("http"), | |
url = require("url"), | |
path = require("path"), | |
fs = require("fs"), | |
contentTypes = require('./content-types'), | |
sysInfo = require('./sys-info'), | |
port = process.argv[2] || 8888; | |
http.createServer(function(request, response) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'), | |
server = express(), | |
path = require('path'), | |
port = process.argv[2] || 80; | |
server.use(express.static(path.join(__dirname, 'assets'))); | |
server.use(express.static(path.join(__dirname, 'build/content'))); | |
server.listen(port); | |
console.log('Listening on port ' + port); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Some helper functions to transform/handle values | |
* between known colour formats | |
* atm: RGB, hex, HSL | |
*/ | |
// RGB > Hex | |
function rgbToHex(r, g, b) { | |
function componentToHex(c) { | |
var hex = c.toString(16); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* | |
* This function does not attempt to implement all of sprintf, just %s, | |
* which is the only one that I ever use. | |
*/ | |
function sprintf(text){ | |
var i = 1, | |
args = arguments; | |
return text.replace(/%s/g, function(pattern) { | |
return (i < args.length) ? args[i++] : ""; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function addGoogleFont(FontName) { | |
$("head").append("<link href='https://fonts.googleapis.com/css?family=" + FontName + "' rel='stylesheet' type='text/css'>"); | |
} | |
function addCustomFont(url) { | |
$("head").append("<link href='" + link + "' rel='stylesheet' type='text/css'>"); | |
} | |
// Usage | |
addGoogleFont("Junge"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Delay before starting | |
DELAY=10 | |
# Sound notification to let one know when recording is about to start (and ends) | |
beep() { | |
paplay /usr/share/sounds/KDE-Im-Irc-Event.ogg & | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Delay before starting | |
DELAY=10 | |
# Sound notification to let one know when recording is about to start (and ends) | |
beep() { | |
paplay /usr/share/sounds/KDE-Im-Irc-Event.ogg & | |
} |