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( $ ) { | |
$.eachWait = function(arr, callback, interval, bulksize) { | |
interval = interval || 10; | |
bulksize = bulksize || 10; | |
var index = 0; | |
var intervalObj = setInterval(function() { | |
for(var j = 0; j<bulksize; j++) { | |
if (index < arr.length) { | |
try { | |
callback(index, arr[index]); |
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
// using jQuery | |
// NS is just some global namespace, replace as you see fit | |
NS = { | |
init: function() { | |
var mvcContext = $('body').data('controller-and-action'); | |
NS.Context.controller = mvcContext.controller.toLowerCase(); | |
NS.Context.action = mvcContext.action.toLowerCase(); | |
var callIfFunction = function(arg) { if ($.isFunction(arg)) { arg(); } }; |
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
public class LessBundle : Bundle | |
{ | |
public LessBundle(string virtualPath) : base(virtualPath, new LessTransform(), new CssMinify()) { } | |
} | |
public class LessTransform : IBundleTransform | |
{ | |
public void Process(BundleContext context, BundleResponse response) | |
{ | |
var sb = new StringBuilder(); |
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
angular.module('SampleModule', []) | |
.factory('SampleService', ['$resource', function(resource) { | |
// ... | |
}) | |
.controller('SampleController', ['$scope', '$resource', function(scope, resource) { | |
// ... | |
}); | |
// Alternative notation using $inject: |
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 dem = angular.module('DocumentEventsModule', []); | |
angular.forEach(['click', 'dblclick', 'mousedown', 'mouseup', 'mouseover', 'mouseout', 'mousemove', 'mouseenter', 'mouseleave'], function(name) { | |
var capitalizedName = name.charAt(0).toUpperCase() + name.slice(1); | |
var directiveName = 'doc' + capitalizedName; | |
dem.directive(directiveName, ['$parse', '$document', function(parse, document) { | |
return function(scope, element, attr) { | |
var fn = parse(attr[directiveName]); | |
document.bind(name, function(event) { | |
scope.$apply(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
angular.module('LocalCacheModule', []). | |
factory('LocalCache', ['$q', '$log', function(q, log) { | |
var retrievers = {}; | |
var ttls = {}; | |
var localCache = { | |
retrieve: function(key, ready) { | |
var retriever = retrievers[key]; | |
if (angular.isFunction(retriever)) { | |
retriever(function(data) { | |
localCache.put(key, data); |
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
if (typeof String.prototype.decodeEntities == 'undefined') { | |
(function () { | |
// this prevents any overhead from creating the object each time | |
var element = document.createElement('div'); | |
String.prototype.decodeEntities = function () { | |
var str = this; | |
// strip script/html tags | |
str = str.replace(/<script[^>]*>([\S\s]*?)<\/script>/gmi, ''); | |
str = str.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gmi, ''); | |
element.innerHTML = str; |
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 dumpObject(root, indent){ | |
if(indent == null) indent = " "; | |
function toType(obj) { | |
return ({}).toString.call(obj).match(/\s([a-zA-Z]+)/)[1]; | |
} | |
var queue = [{ data: root, level: 0 }]; | |
function add(data, level, prepend) { | |
queue.push({data: data, level: level, prepend: prepend}); |
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
@echo off | |
set HANDBRAKE="C:\Program Files\Handbrake\HandBrakeCLI.exe" | |
for /r %%a in (*.avi *.mkv *.wmv *.divx *.mpg *.mpeg *.m4v *.ogg) do %HANDBRAKE% -i "%%~a" -o "%%~dpna_.mkv" -e x264 -q 20 -E faac -B 128 --x264-preset medium --x264-profile main -x level=4.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
<html ng-app> | |
<head> | |
<title>Visual Studio 2012 Colors</title> | |
<style> | |
body > p > span { | |
width: 90px; | |
border: 2px solid black; | |
display: inline-block; | |
font: 10pt 'Courier New', 'Courier', 'monospace'; | |
text-align: center; |
OlderNewer