Skip to content

Instantly share code, notes, and snippets.

@gf3
gf3 / jsonp.js
Created June 18, 2009 18:18
Simple JSONP in vanilla JS
/**
* loadJSONP( url, hollaback [, context] ) -> Null
* - url (String): URL to data resource.
* - hollaback (Function): Function to call when data is successfully loaded,
* it receives one argument: the data.
* - context (Object): Context to invoke the hollaback function in.
*
* Load external data through a JSONP interface.
*
* ### Examples
@endolith
endolith / Has weird right-to-left characters.txt
Last active August 13, 2025 10:44
Unicode kaomoji smileys emoticons emoji
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
@jwage
jwage / SplClassLoader.php
Last active August 16, 2024 17:36
Add MIT license.
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# default server
server {
listen 80;
server_name local.kohanaphp.com;
root /Volumes/Webserver/Checkout/projects/kohana/v3;
location / {
index index.php index.html index.htm;
try_files $uri $uri/ index.php$uri;
@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;
@mrcgrtz
mrcgrtz / placeholder.js
Created April 21, 2010 10:29
Adds something like HTML5 placeholders when they are not supported by your browser. Usage: <input placeholder="Foobar">
var MyApp = {
addPlaceholders: function(props) {
// default configuration
var config = {
'class': 'placeholder' // apply CSS classes to an input displaying a placeholder
};
// if any properties were supplied, apply them to the config object
@mrcgrtz
mrcgrtz / buttons.css
Created April 23, 2010 11:38
Scalable CSS3 gradient buttons
/* @group Buttons */
button , .button {
display: -moz-inline-stack;
display: inline-block;
zoom: 1;
cursor: pointer;
color: #fff;
background: #f60;
background: #f60 -moz-linear-gradient(top, #ff8f00, #ff4f00);
background: #f60 -webkit-gradient(linear, left top, left bottom, color-stop(0, #ff8f00), color-stop(1, #ff4f00));
@mrcgrtz
mrcgrtz / box-shadow.css
Created June 9, 2010 14:28
box-shadow for Opera, Gecko, Webkit and IE8.
.box-shadow {
-webkit-box-shadow: 0 1px 3px #aaa; /* Webkit */
-moz-box-shadow: 0 1px 3px #aaa; /* Gecko */
box-shadow: 0 1px 3px #aaa; /* CSS3 default, should be after vendor-specific properties */
-ms-filter: "progid:DXImageTransform.Microsoft.Shadow(color='#aaaaaa', Direction=0, Strength=2)
progid:DXImageTransform.Microsoft.Shadow(color='#aaaaaa', Direction=45, Strength=1)
progid:DXImageTransform.Microsoft.Shadow(color='#aaaaaa', Direction=90, Strength=2)
progid:DXImageTransform.Microsoft.Shadow(color='#aaaaaa', Direction=135, Strength=1)
progid:DXImageTransform.Microsoft.Shadow(color='#aaaaaa', Direction=180, Strength=2)
progid:DXImageTransform.Microsoft.Shadow(color='#aaaaaa', Direction=225, Strength=1)
<?php defined('SYSPATH') or die('No direct script access.');
/**
* User to user communication wrapper. Uses Swift Mailer for email transport.
*
* @package Communicate
* @category Base
* @author Woody Gilk <[email protected]>
* @copyright (c) 2010 Woody Gilk
* @license MIT
*/
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active April 14, 2025 11:07
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh