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() { | |
device.ajax( | |
{ | |
url: 'http://underscorejs.org/underscore-min.js', | |
type: 'GET', | |
headers: { | |
'Content-Type': 'text/javascript' | |
} | |
}, | |
function onSuccess(body, textStatus, response) { |
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
/* | |
fetch: function(path) { | |
path = path + ".html"; | |
path = path.slice(1); | |
window.JST = window.JST || {}; | |
if (JST[path]) { | |
return Handlebars.template(JST[path]); | |
} |
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
# | |
# jQuery Unit Test Configuration File. | |
# Copyright 2012, Tim Branyen (@tbranyen) | |
# This configuration file may be freely distributed under the MIT license. | |
# | |
# Include this file (named jquery.conf) alongside the jquery folder and run | |
# with root privileges: | |
# | |
# sudo nginx -c /absolute/path/to/jquery.conf | |
# |
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
<div id="search_container"></div> | |
<script type="text/javascript"> | |
SearchView = Backbone.View.extend({ | |
initialize: function(){ | |
this.render(); | |
}, | |
render: function(){ | |
// Compile the template using underscore | |
var template = _.template( $("#search_template").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
var parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |
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
parser.href = url; | |
var hostname2 = parser.hostname; | |
var search2 = parser.search; | |
/* | |
Notes: | |
- extremely slow | |
*/ |
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 updateDates() { | |
var startDate = $("#start-date").datepicker("getDate"); | |
$("#menu-item-1 .day").text(startDate.getDate()); | |
$("#menu-item-1 .month").text(Util.monthToText(startDate.getMonth())); | |
$("#menu-item-1 .year").text(startDate.getFullYear()); | |
var endDate = $("#end-date").datepicker("getDate"); | |
$("#menu-item-2 .day").text(endDate.getDate()); |
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
// Save this in a bookmarklet and click it on a page: | |
javascript:(function(){function d(a,c){document.body.style.webkitClipPath="circle("+a+"px, "+c+"px, "+b+"px)"}var b=90;window.addEventListener("mousemove",function(a){d(a.pageX,a.pageY)});window.addEventListener("mousewheel",function(a){if(a.shiftKey){a.preventDefault();var c=a.wheelDeltaY;b+=-c;b=0<c?Math.max(90,b):Math.min(b,window.innerHeight/2);d(a.pageX,a.pageY)}})})(); | |
// Or paste this in the console and mouse over the page. | |
// SHIFT+mousewheel scroll makes the circle bigger/smaller. | |
(function() { | |
var radius = 90; // px |
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
requirejs: { | |
// Include the main configuration file. | |
mainConfigFile: "app/config.js", | |
// Output file. | |
out: "dist/debug/require.js", | |
// Root application module. | |
name: "config", |
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
# DO NOT RESPOND TO REQUESTS OTHER THAN yourdomain.com | |
server { | |
listen 80 default; | |
server_name _; | |
return 444; | |
} | |
# FILE UPLOADS | |
server { | |
listen 80; |