This code how to replace the traditional radio-buttons, for custom images. You can do the same with checkboxes.
This file contains 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains 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
/** | |
* | |
* Javascript color conversion | |
* http://www.webtoolkit.info/javascript-color-conversion.html | |
* | |
**/ | |
function HSV(h, s, v) { | |
if (h <= 0) { h = 0; } | |
if (s <= 0) { s = 0; } |
This file contains 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
// 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){ |
This file contains 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 | |
# For this to work, you need to have ffmpeg | |
# installed with libvorbis, theora and libvpx ENABLED | |
# to do that in Homebrew: | |
# brew reinstall ffmpeg --with-libvpx --with-libvorbis --with-theora | |
# | |
# encoding reference: | |
# https://blog.mediacru.sh/2013/12/23/The-right-way-to-encode-HTML5-video.html |
This file contains 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
# convert mp4 to ogv and/or webm | |
# mp4: http://caniuse.com/#search=mp4 | |
# ogv: http://caniuse.com/#search=ogv | |
# webm: http://caniuse.com/#search=webm | |
# install | |
brew install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-frei0r --with-libass --with-libvo-aacenc --with-libvorbis --with-libvpx --with-opencore-amr --with-openjpeg --with- --with-rtmpdump --with-schroedinger --with-speex --with-theora --with-tools | |
# mp4 to ogv |
This file contains 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
/** | |
* Combine page scripts and styles. | |
* | |
* Usage: | |
* 1. Copy/Paste and execute this script in the browser console | |
* 2. Call combineScripts() or combineStyles() | |
* | |
* Press ESC to hide textarea. | |
* | |
* P.S. Use http://refresh-sf.com/ to create min.js and min.css |
This file contains 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 | |
# from | |
# http://bergamini.org/computers/creating-favicon.ico-icon-files-with-imagemagick-convert.html | |
convert source-WxW.png -resize 256x256 -transparent white favicon-256.png | |
convert favicon-256.png -resize 16x16 favicon-16.png | |
convert favicon-256.png -resize 32x32 favicon-32.png | |
convert favicon-256.png -resize 64x64 favicon-64.png | |
convert favicon-256.png -resize 128x128 favicon-128.png |
This file contains 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> | |
<html lang="en"> | |
<head> | |
<!-- Le styles --> | |
<link href="../bootstrap/css/bootstrap.css" rel="stylesheet"> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"></script> | |
</head> | |
<body> |
This file contains 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 getCss = function(el) { | |
var style = window.getComputedStyle(el); | |
return Object.keys(style).reduce(function(acc, k) { | |
var name = style[k], | |
value = style.getPropertyValue(name); | |
if (value !== null) { | |
acc[name] = value; | |
} | |
return acc; | |
}, {}); |
OlderNewer