Skip to content

Instantly share code, notes, and snippets.

View samarpanda's full-sized avatar
👋

Samar Panda samarpanda

👋
View GitHub Profile
@paulirish
paulirish / gist:366184
Created April 14, 2010 18:59
html5 geolocation with fallback.
// geo-location shim
// currentely only serves lat/long
// depends on jQuery
// doublecheck the ClientLocation results because it may returning null results
;(function(geolocation){
if (geolocation) return;
@karmi
karmi / .gitignore
Created November 27, 2010 16:26
`tail -f` in Node.js and WebSockets
.DS_Store
*.log
tmp/
@jed
jed / LICENSE.txt
Created May 20, 2011 13:27 — forked from 140bytes/LICENSE.txt
generate random UUIDs
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@mmalecki
mmalecki / nextTick.js
Created October 2, 2011 12:13
process.nextTick vs setTimeout(fn, 0)
for (var i = 0; i < 1024 * 1024; i++) {
process.nextTick(function () { Math.sqrt(i) } )
}
@jxson
jxson / README.md
Created February 10, 2012 00:18
README.md template

Synopsis

At the top of the file there should be a short introduction and/ or overview that explains what the project is. This description should match descriptions added for package managers (Gemspec, package.json, etc.)

Code Example

Show what the library does as concisely as possible, developers should be able to figure out how your project solves their problem by looking at the code example. Make sure the API you are showing off is obvious, and that your code is short and concise.

Motivation

@samarpanda
samarpanda / boxshadow.css
Created February 14, 2012 05:06
Boxshadow for IE7 and IE8 css
.boxshadow{
background-color: #fff;
filter: progid:DXImageTransform.Microsoft.Shadow(color='#b7b8b3', Direction=120, Strength=3);
zoom: 1;
}
.boxshadow-disable{
filter: progid:DXImageTransform.Microsoft.Shadow(enabled=false);
}
@cuppster
cuppster / node-express-cors-middleware.js
Created April 9, 2012 16:02
express.js middleware to support CORS pre-flight requests
app.use(express.methodOverride());
// ## CORS middleware
//
// see: http://stackoverflow.com/questions/7067966/how-to-allow-cors-in-express-nodejs
var allowCrossDomain = function(req, res, next) {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');
res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization');
@seeekr
seeekr / apache-webp-rewrite.conf
Last active March 10, 2024 22:34
enabling apache to serve WebP image files if accepted by browser (and .webp files available)
## !! This snippet has been updated, but not tested in practice. It should work, please check / leave comments in case it doesn't. !! ##
# originally from https://groups.google.com/a/webmproject.org/group/webp-discuss/browse_thread/thread/196ac4ea705688d8
<IfModule mod_rewrite.c>
# TODO: don't forget to put
# AddType image/webp .webp
# in your mods-available/mime.conf
# (though this is optional because we're setting
# the mime type manually in the RewriteRule)
@irae
irae / .jslintrc
Created May 21, 2012 19:22
my jslintrc
{
/*** Globals ***/
// To ignore any custom global variables, enable the `predef` option and list
// your variables within it.
"predef": [
"exports",
"YUITest",
"YUI",
"YUI_config",
"YAHOO",
@JeffreyWay
JeffreyWay / gist:2889230
Created June 7, 2012 14:56
Simple PHP Quiz
// Fun little quiz
Assuming this string: "January 5th, 2012"
In the shortest amount of code possible, place:
- 'January' within a $month variable
- '5th' within a $day variable
- '2012' within a $year variable.