Skip to content

Instantly share code, notes, and snippets.

@tim-smart
tim-smart / usage_main.js
Created February 7, 2010 02:46
Node.js Web Workers
// The main node process
// Will output to shell:
// {
// "test": "test"
// }
// "bam"
var worker = require('./webworker'),
sys = require('sys');
@jed
jed / LICENSE.txt
Created May 10, 2011 14:44 — forked from 140bytes/LICENSE.txt
route client urls with 404s and pattern captures
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
@kurtschindler
kurtschindler / hs-blog-NHibernateGlimpsePlugin.txt
Created July 29, 2011 19:07
NHibernate Glimpse Plugin - full source
http://www.headspring.com/2011/07/creating-a-glimpse-plugin-to-log-sql-generated-by-nhibernate
The following code is all that's required to implement a Glimpse plugin that renders the SQL generated by NHibernate. A full blog post describing this is at the link above.
1. Create a custom Log4Net appender:
-----------------------------------
public class NHibernateQueryAppender : AppenderSkeleton
{
protected override void Append(LoggingEvent loggingEvent)
@jthomas
jthomas / nano.profile.js
Created July 23, 2012 11:05
Nano-build profile
var profile = (function(){
return {
layerOptimize: "closure",
releaseDir: "../../../release",
packages:[{
name:"dojo",
location:"../../../dojo"
}],
@akre54
akre54 / react-svg-patch.coffee
Last active November 23, 2015 18:02
React SVG element monkeypatch
ReactDOM = require 'react/lib/ReactDOM'
ReactElement = require 'react/lib/ReactElement'
ReactElementValidator = require 'react/lib/ReactElementValidator'
SVGDOMPropertyConfig = require 'react/lib/SVGDOMPropertyConfig'
MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE
createFactory = if __DEV__
ReactElementValidator.createFactory
else
ReactElement.createFactory
@SimplGy
SimplGy / runner.js
Created February 28, 2013 20:00
Updated PhantomJS QUnit runner to support RequireJS and CurlJS modules, which can load *after* QUnit.done is called. Also improved the console output and added a global timeout. If your test suite takes longer than `timeLimit` to run, it'll fail.
/*
* QtWebKit-powered headless test runner using PhantomJS
*
* PhantomJS binaries: http://phantomjs.org/download.html
* Requires PhantomJS 1.6+ (1.7+ recommended)
*
* Run with:
* phantomjs runner.js [url-of-your-qunit-testsuite]
*
* e.g.
@indexzero
indexzero / cocoa-hello-world2.js
Created September 8, 2011 18:33 — forked from TooTallNate/cocoa-hello-world2.js
Creating a Cocoa GUI window with NodObjC, with a proper Menu, dock icon, and NSApplicationDelegate.
// This example adapted from Matt Gallagher's "Minimalist Cocoa Programming"
// blog article:
// http://cocoawithlove.com/2010/09/minimalist-cocoa-programming.html
var $ = require('NodObjC')
$.import('Cocoa')
var pool = $.NSAutoreleasePool('alloc')('init')
, app = $.NSApplication('sharedApplication')
@papayasoft
papayasoft / index.php
Created May 29, 2012 04:12
Zend Framework bootstrap without Zend_Application
<?php
// A first run at a Zend Framework pre-1.8 bootstrap file that does not use Zend_Application
// Not tested, just thinking out loud...
// Do your PHP settings like timezone, error reporting
// ..
// Define path to application directory
defined('APPLICATION_PATH')
@RudyLu
RudyLu / facebook_strophe.html
Created May 24, 2013 04:58
The sample code of using Strophe.js to connect to facebook chat
<html>
<head>
<script src="http://connect.facebook.net/en_US/all.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script src="strophe-102.js" type="text/javascript"></script>
<script src="facebook.js" type="text/javascript"></script>
<script>
var BOSH_SERVICE = 'http://island.csie.org:8273/xmpp-httpbind'
var connection = null;
// <copyright file="LeastRecentlyUsedCache.cs" company="http://www.sinbadsoft.com">
// Copyright (c) Chaker Nakhli 2013
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
// License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
// applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language
// governing permissions and limitations under the License.
// </copyright>
// <author>Chaker Nakhli</author>
// <email>Chaker.Nakhli@sinbadsoft.com</email>