Skip to content

Instantly share code, notes, and snippets.

View corpix's full-sized avatar
👹
Fighting demons

corpix corpix

👹
Fighting demons
View GitHub Profile
<html>
<head>
<script src="http://crashkitapp.appspot.com/static/javascript/crashkit-javascript.js?test/js" type="text/javascript" charset="utf-8"></script>
<!-- <script src="http://localhost:5005/static/javascript/crashkit-javascript.js?test/js" type="text/javascript" charset="utf-8"></script> -->
<script src="crashkit-javascript-sample.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
function xxx(a) {
yyy(a, a, a);
}
# node.js app under nginx
upstream node {
server 127.0.0.1:8001;
}
server {
listen 80;
server_name node;
@jankuca
jankuca / index.js
Created January 20, 2011 16:21
RelativeDate Node.js module
exports.parse = function (string, format) {
var match = string.match(/^(\+|-)\s*(\d+)\s*([a-z]{3})/i);
var add;
if (!match) {
add = 0;
} else {
add = parseInt(match[2], 10);
switch (match[3]) {
case 'min':
add *= 60;
var util = require('util'),
fs = require('fs');
module.exports = function(server, everyone) {
server.get('/streamFriendFile', function(req, res) {
util.debug('CLIENT REQUESTED STREAM FRIEND FILE');
util.debug('request headers: ' + util.inspect(req.headers));
util.debug('request params: ' + util.inspect(req.params));
//set headers
@ericmoritz
ericmoritz / README.rst
Created May 13, 2011 01:17
crazy-template.js

crazy_template

A template engine in 42 lines of code.

About

I was thinking of a way to generate HTML without using strings as embedding strings in Javascript is a pain if they are multi-lined. There isn't a nice triple quote like there exists in Python.

So I took my inspiration from Lisp HTML generators that use S-expressions to generate HTML. I thought, hell, S-expressions are just a bunch of nested lists, I could do the same thing in Javascript.

var express = require('./')
, http = require('http')
, https = require('https')
, app = express.createServer();
app.use(express.static(__dirname));
http.createServer(app.handle.bind(app)).listen(3000);
https.create....
@corpix
corpix / formdata.js
Created November 23, 2011 13:37
FormData html5Uploader
(function($){
$.fn.html5Uploader = function(){
return this.each(function(){
var $this = $(this);
if($this.is('[type="file"]')){
$this.bind('change', function(){
var files = this.files;
for(var i = 0;i < files.length;i++){
fileHandler.call($this, files[i]);
}
@thurloat
thurloat / formview.coffee
Created January 18, 2012 02:59
Backbone Form -> Model sync View
# FormView Class
#
# Backbone View subclass that will allow you to bind input fields
# to model fields and keep the data in sync using the same
# declarative syntax you're used to for Backbone Views.
#
# blog post: http://thurloat.com/2012/01/17/backbone-sync-models-and-views
#
# class TestView extends FormView
#
function git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\ \(\1\)/'
}
PS1=" λ \W\$(git_branch): "
PS2=" | "
@tj
tj / profile.js
Created September 5, 2012 04:58
nshell profile
/**
* Module dependencies.
*/
var path = require('path')
// prompt
exports.PS1 = function(){