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 subpixelWordSpacing = false; | |
if (document.defaultView && document.defaultView.getComputedStyle) { | |
// Store the original word spacing on the document element | |
var originalWordSpacing = document.defaultView.getComputedStyle(document.documentElement, null).wordSpacing; | |
// Set the word-spacing to half a pixel | |
document.documentElement.style.wordSpacing = '0.5px'; | |
// This will return either 0px or 1px if sub-pixel word-spacing is not supported, otherwise |
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 countCSSRules() { | |
var results = '', | |
log = ''; | |
if (!document.styleSheets) { | |
return; | |
} | |
for (var i = 0; i < document.styleSheets.length; i++) { | |
countSheet(document.styleSheets[i]); | |
} | |
function countSheet(sheet) { |
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 nestedCallbacks(callback) { | |
console.log("start"); | |
firstNest(function () { | |
secondNest(function () { | |
callback("test"); | |
}); | |
}); | |
} | |
function firstNest(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
var repeatingArray = [4, 5, 6]; | |
var circularObj = { | |
a: 1, | |
b: 1, | |
c: "an allowed repeating string", | |
d: "an allowed repeating string", | |
e: repeatingArray, | |
f: repeatingArray, | |
g: [ |
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 censor(censor) { | |
var i = 0; | |
return function(key, value) { | |
if(i !== 0 && typeof(censor) === 'object' && typeof(value) == 'object' && censor == value) | |
return '[Circular]'; | |
if(i >= 29) // seems to be a harded maximum of 30 serialized objects? | |
return '[Unknown]'; |
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
import os | |
import sys | |
output_folder = os.path.abspath(sys.argv[1]) | |
from mincss.processor import Processor | |
p = Processor() | |
urls = [] | |
css_files = {} | |
for root, dirs, files in os.walk(output_folder): | |
for f in files: |
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
/* 1. make sure not to refresh page on search */ | |
$routeProvider.when({ | |
reloadOnSearch = false; | |
}); | |
/* 2. call to refresh the browser page in the application */ | |
$location.search('refreshed', 'true'); // set the query param | |
//allow for scope digest cycle | |
$timeout(function() { |
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
beforeEach(module('ngCookies', function($provide) { | |
$provide.factory('$browser', function(){ | |
return angular.extend(new angular.mock.$Browser(), {cookieHash: {selectedLanguage:undefined}}); | |
}); | |
})); | |
it('cookie for selected should default to english', function() { | |
expect($cookies).toEqual({'selectedLanguage':undefined}); | |
// access internal cookie storage of the browser mock directly to simulate behavior of document.cookie | |
$browser.poll(); |
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/ruby | |
# Create display override file to force Mac OS X to use RGB mode for Display | |
# see http://embdev.net/topic/284710 | |
require 'base64' | |
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay` | |
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten | |
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten |
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
# Hide show files by alias | |
alias showFiles='defaults write com.apple.finder AppleShowAllFiles YES; killall Finder /System/Library/CoreServices/Finder.app' | |
alias hideFiles='defaults write com.apple.finder AppleShowAllFiles NO; killall Finder /System/Library/CoreServices/Finder.app' |
OlderNewer