Skip to content

Instantly share code, notes, and snippets.

View gasi's full-sized avatar

Daniel Gasienica gasi

View GitHub Profile
@insin
insin / contactform.js
Last active January 9, 2024 05:27
React contact form example
/** @jsx React.DOM */
var STATES = [
'AL', 'AK', 'AS', 'AZ', 'AR', 'CA', 'CO', 'CT', 'DE', 'DC', 'FL', 'GA', 'HI',
'ID', 'IL', 'IN', 'IA', 'KS', 'KY', 'LA', 'ME', 'MD', 'MA', 'MI', 'MN', 'MS',
'MO', 'MT', 'NE', 'NV', 'NH', 'NJ', 'NM', 'NY', 'NC', 'ND', 'OH', 'OK', 'OR',
'PA', 'RI', 'SC', 'SD', 'TN', 'TX', 'UT', 'VT', 'VA', 'WA', 'WV', 'WI', 'WY'
]
var Example = React.createClass({
@aseemk
aseemk / gist:5191967
Created March 18, 2013 23:30
Sexy method argument overloading in CoffeeScript.
#
# Overloads:
# - fetch(url, callback)
# - fetch(url, opts, callback)
#
fetch = (args...) ->
[arg0, arg1, arg2] = args
[url, opts, callback] = switch args.length
when 0, 1 then throw new Error "Usage: fetch(url[, opts], callback)"
when 2 then [arg0, null, arg1]
@aseemk
aseemk / migrate._coffee
Created May 10, 2012 22:34
Helper script to migrate Streamline files to the new ._js/._coffee extensions.
#!/usr/bin/env _coffee
#
# Migrates our Streamline v0.1 files to the new Streamline v0.3 extensions,
# i.e. git-moves all foo_.coffee files to foo._coffee.
{exec} = require 'child_process'
Path = require 'path'
# regex to recognize old-style streamline files:
STREAMLINE_REGEX = /_\.(js|coffee)$/
@theconektd
theconektd / github.css
Created April 30, 2012 02:11
Github Markdown CSS - for Markdown Editor Preview
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {
@gasi
gasi / akamai.js
Created February 17, 2012 17:31
Purge Akamai CDN using Node.js
var request = require('request');
var settings = {
AKAMAI_USER: 'test',
AKAMAI_PASSWORD: '...',
AKAMAI_NOTIFICATION_EMAIL: ''
};
var akamai = exports;
var SOAP_URL = 'https://ccuapi.akamai.com:443/soap/servlet/soap/purge';
@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@indexzero
indexzero / v8-0412.js
Created January 3, 2012 05:30
Properties of Error instances in the latest V8 included by [email protected] are not enumerable. And thus cannot be serialized through JSON.stringify
> var err = new Error('wtf?');
> JSON.stringify(err)
'{"stack":"Error: wtf?\\n at [object Context]:1:11\\n at Interface.<anonymous> (repl.js:179:22)\\n at Interface.emit (events.js:64:17)\\n at Interface._onLine (readline.js:153:10)\\n at Interface._line (readline.js:408:8)\\n at Interface._ttyWrite (readline.js:585:14)\\n at ReadStream.<anonymous> (readline.js:73:12)\\n at ReadStream.emit (events.js:81:20)\\n at ReadStream._emitKey (tty_posix.js:307:10)\\n at ReadStream.onData (tty_posix.js:70:12)","message":"wtf?"}'
> Object.keys(err);
[ 'stack', 'arguments', 'type', 'message' ]
> Object.getOwnPropertyDescriptor(err, 'stack');
{ get: [Function], set: [Function], enumerable: true, configurable: true }
> process.versions.v8
'3.1.8.26'
@rauchg
rauchg / ms.md
Created December 21, 2011 00:25
Milliseconds conversion utility.
@benvanik
benvanik / pyramiddemo.html
Created December 14, 2011 06:06
Simple Image Pyramid Demo
<!DOCTYPE html>
<html>
<head>
<title>Image Pyramid Demo</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0,user-scalable=no">
<script src="pyramiddemo.js"></script>
<style>
body {
@somebox
somebox / gh-like.css
Created July 14, 2011 14:55
github markdown css+script with syntax highlighting. Works with http://markedapp.com
/*
Some simple Github-like styles, with syntax highlighting CSS via Pygments.
*/
body{
font-family: helvetica, arial, freesans, clean, sans-serif;
color: #333;
background-color: #fff;
border: none;
line-height: 1.5;
margin: 2em 3em;