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 each = function (Array) {"use strict"; | |
/*! all you need to `each(obj, cb [,context])` | |
* @author WebReflection | |
* @license WTFPL - http://en.wikipedia.org/wiki/WTFPL | |
* @gist https://gist.github.com/2294934 | |
*/ | |
var | |
toString = {}.toString, | |
hasOwnProperty = {}.hasOwnProperty, | |
array = toString.call([]), |
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
// selection range | |
var range = window.getSelection().getRangeAt(0); | |
// plain text of selected range (if you want it w/o html) | |
var text = window.getSelection(); | |
// document fragment with html for selection | |
var fragment = range.cloneContents(); | |
// make new element, insert document fragment, then get innerHTML! |
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
// 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 |
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
/** | |
* Polyfill for "fixing" IE's lack of support (IE < 9) for applying slice | |
* on host objects like NamedNodeMap, NodeList, and HTMLCollection | |
* (technically, since host objects are implementation-dependent, | |
* IE doesn't need to work this way). Also works on strings, | |
* fixes IE to allow an explicit undefined for the 2nd argument | |
* (as in Firefox), and prevents errors when called on other | |
* DOM objects. | |
* @license MIT, GPL, do whatever you want | |
-* @see https://gist.github.com/brettz9/6093105 |
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
#!/usr/bin/env bash | |
# MIT © Sindre Sorhus - sindresorhus.com | |
# git hook to run a command after `git pull` if a specified file was changed | |
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`. | |
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" | |
check_run() { | |
echo "$changed_files" | grep --quiet "$1" && eval "$2" |
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 me = Services.wm.getMostRecentWindow(null); | |
Cu.import('resource://gre/modules/osfile.jsm'); | |
var pathProfilesIni = OS.Path.join(OS.Constants.Path.userApplicationDataDir, 'profiles.ini'); | |
me.alert(pathProfilesIni); | |
//apparently theres for profiles made in default prof dir: | |
//localDir = C:\Users\ali57233\AppData\Local\Mozilla\Firefox\Profiles\czbm1ps9.rnd1 | |
//rootDir = C:\Users\ali57233\AppData\Roaming\Mozilla\Firefox\Profiles\czbm1ps9.rnd1 | |
//for custom prof dir localDir and rootDir are same |
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
/** | |
* Chunkify | |
* Google Chrome Speech Synthesis Chunking Pattern | |
* Fixes inconsistencies with speaking long texts in speechUtterance objects | |
* Licensed under the MIT License | |
* | |
* Peter Woolley and Brett Zamir | |
*/ | |
var speechUtteranceChunker = function (utt, settings, callback) { |
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
// Microrouter based on history.pushState. | |
// All thrills, no frills. | |
// Usage: | |
// | |
// var h = urlstate(callback); | |
// h.push('#foo') | |
function urlstate(callback) { | |
// Since `history.pushState` doesn't fire `popstate`, we can use this function | |
// instead. Will update history state and call `callback` with currently | |
// showing `url`. |
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
function jml (elName, atts, children) {'use strict'; | |
var el = typeof elName === 'string' ? document.createElement(elName) : elName; | |
if (atts && Array.isArray(atts)) { | |
children = atts; | |
} | |
else if (atts) { | |
Object.keys(atts).forEach(function (att) { | |
var attVal = atts[att]; | |
if (att === '$on') { | |
return Object.keys(attVal).forEach(function (ev) { |
OlderNewer