Skip to content

Instantly share code, notes, and snippets.

View Linrstudio's full-sized avatar
🌴
On vacation

xyz Linrstudio

🌴
On vacation
View GitHub Profile
@jonathantneal
jonathantneal / Demo
Created April 18, 2012 17:13
addEventListener for IE8
http://jsfiddle.net/GuQaV/show/
@rcoup
rcoup / strip-utf8-bom.vbs
Created April 26, 2012 00:50
WScript to strip UTF-8 BOM from a text/CSV file
' Usage: strip-utf8-bom.vbs file.csv
' Notes:
' this isn't suitable for large files unless you have a lot of memory - ADODB.Stream reads the entire file into
' memory, then builds the output buffer in memory as well. #stupid
If WScript.Arguments.Count <> 1 Then
WScript.Echo "Usage: strip-utf8-bom.vbs file.csv"
WScript.Quit
End If
javascript:(function(){if (!document.getElementById('someuniqueid')){var objHead = document.getElementsByTagName('head'); if (objHead[0]){if (document.createElementNS && objHead[0].tagName == 'head') var objCSS = objHead[0].appendChild(document.createElementNS('http://www.w3.org/1999/xhtml', 'link')); else var objCSS = objHead[0].appendChild(document.createElement('link')); objCSS.id = 'someuniqueid'; objCSS.rel = 'stylesheet'; objCSS.href = 'data:text/css,*{-webkit-transform-style:preserve-3d;-webkit-transition:-webkit-transform 1s ease-in-out,box-shadow 1s ease-in-out,outline 1s ease-in-out}*:hover{background:rgba(255,255,255,.25);outline:1px solid rgba(0,0,0,.25);-webkit-transform:translateZ(100px);box-shadow:0 0 10px #cacaca}html{-webkit-transition:-webkit-transform 1s ease-in-out}html:hover{-webkit-transform:perspective(800px) rotateY(10deg) translateZ(-700px)}body{height:100%}'; objCSS.type = 'text/css';}}})()
@getify
getify / naf.js
Created June 27, 2012 14:19
requestNextAnimationFrame() and cancelNextAnimationFrame()
// requires raf.js (polyfil)
(function(){
var ids = {};
function requestId(){
var id;
do {
id = Math.floor(Math.random() * 1E9);
} while (id in ids);
@ydaniv
ydaniv / mozGetMatchedCSSRules.js
Created July 2, 2012 12:32
A Gecko only polyfill for Webkit's window.getMatchedCSSRules
// polyfill window.getMatchedCSSRules() in FireFox 6+
if ( typeof window.getMatchedCSSRules !== 'function' ) {
var ELEMENT_RE = /[\w-]+/g,
ID_RE = /#[\w-]+/g,
CLASS_RE = /\.[\w-]+/g,
ATTR_RE = /\[[^\]]+\]/g,
// :not() pseudo-class does not add to specificity, but its content does as if it was outside it
PSEUDO_CLASSES_RE = /\:(?!not)[\w-]+(\(.*\))?/g,
PSEUDO_ELEMENTS_RE = /\:\:?(after|before|first-letter|first-line|selection)/g;
// convert an array-like object to array
@seank-com
seank-com / createAndSaveCompositeImage.js
Last active June 23, 2017 16:19
Create a composite image of all the visible img tags in the DOM and save it to the app data directory of a Windows 8 Application
function SaveSplash() {
window.msWriteProfilerMark("start-render");
var body = document.body,
appdata = Windows.Storage.ApplicationData.current,
localfolder = appdata.localFolder,
canvas = document.createElement("canvas"),
ctx = canvas.getContext("2d"),
imgs = document.body.getElementsByTagName("img"),
@seank-com
seank-com / saveHTMLWithEmbeddedImgTags.js
Last active June 23, 2017 16:17
Update HTML by embedding visible img tags with base64 encoded data URIs then saving it to the app data directory of a Windows 8 Application
function EncodePngBase64(arr) {
var map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
result = "data:image/png;base64,",
size = arr.length,
b1 = 0, b2 = 0, b3 = 0, enc1, enc2, enc3, enc4, i;
for(i = 0; i < size; i += 3) {
b1 = arr[i];
b2 = arr[i + 1] || 0;
@cameronmcefee
cameronmcefee / Crier.as
Created August 24, 2012 17:05
Variable passing for Photoshop panels
package classes {
import com.adobe.csxs.core.CSXSInterface;
import com.adobe.csxs.events.*;
import com.adobe.csxs.external.resources.*;
import com.adobe.csxs.types.*;
import com.adobe.serialization.json.JSON;
import flash.display.Sprite;
@jfsiii
jfsiii / image2base64.js
Created September 6, 2012 01:12
Convert a remote image to Base64-encoded string
// Uses [request](https://github.com/mikeal/request)
// /?url=http://nodejs.org/logo.png
// /?uri=http://nodejs.org/logo.png
// /?url=http://nodejs.org/logo.png&cb=cbName
// /?url=http://nodejs.org/logo.png&callback=cbName
var fs = require('fs');
var url = require('url');
var http = require('http');
var request = require('request');
@kevincennis
kevincennis / gist:3928503
Created October 21, 2012 21:03
Instant karaoke track with the Web Audio API
var url = 'http://static1.kevincennis.com/sounds/callmemaybe.mp3'
, audio = new Audio(url)
, context = new webkitAudioContext()
// 512 samples per frame, stereo input, mono output
, processor = context.createJavaScriptNode(512, 2, 1)
, sourceNode
audio.addEventListener('canplaythrough', function(){
sourceNode = context.createMediaElementSource(audio)
sourceNode.connect(processor)