Skip to content

Instantly share code, notes, and snippets.

View thehydroimpulse's full-sized avatar

Somewhere thehydroimpulse

View GitHub Profile
@thehydroimpulse
thehydroimpulse / gist:2872907
Created June 5, 2012 05:42
A Laravel task generator. Models, Migrations and Controllers.
<?php
/**
* @copyright 2012 TheHydroImpulse, Daniel Fagnan
* @version 0.1
* @todo Add an overwite ability. Among other things.
* @note Use this as you wish. Extend it, Mash it. Enjoy it.
*/
@LeonB
LeonB / serve.sh
Created July 30, 2012 21:03
One-line bash http server
:;while [ $? -eq 0 ];do nc -vlp 8080 -c'(r=read;e=echo;$r a b c;z=$r;while [ ${#z} -gt 2 ];do $r z;done;f=`$e $b|sed 's/[^a-z0-9_.-]//gi'`;h="HTTP/1.0";o="$h 200 OK\r\n";c="Content";if [ -z $f ];then($e $o;ls|(while $r n;do if [ -f "$n" ]; then $e "<a href=\"/$n\">`ls -gh $n`</a><br>";fi;done););elif [ -f $f ];then $e "$o$c-Type: `file -ib $f`\n$c-Length: `stat -c%s $f`";$e;cat $f;else $e -e "$h 404 Not Found\n\n404\n";fi)';done
@elijahmanor
elijahmanor / console.js
Created August 24, 2012 03:27
Custom JSBin Settings
jsbin.settings.editor.theme = "monokai";
jsbin.settings.editor.indentUnit = 4;
jsbin.settings.editor.smartIndent = true;
jsbin.settings.editor.tabSize = 4;
jsbin.settings.editor.indentWithTabs = true;
jsbin.settings.editor.autoClearEmptyLines = true;
jsbin.settings.editor.lineWrapping = true;
jsbin.settings.editor.lineNumbers = true;
jsbin.settings.editor.matchBrackets = true;
@nikcub
nikcub / README.md
Created October 4, 2012 13:06
Facebook PHP Source Code from August 2007

Basic Strategy

Take a match block and add routes to a RouteRecognizer:

match("/posts").to("posts", function(match) {
  match("/").to("postIndex")
  match("/:id").to("showPost");
  match("/edit").to("editPost");
@lancejpollard
lancejpollard / 15ms.js
Last active December 11, 2015 06:38
Benchmark requiring npm modules
module.exports = ms15();
function ms15() {
var fs = require('fs')
, n = 50;
//fs.mkdirSync('./tmp');
for (var i = 0; i < n; i++) {
fs.writeFileSync('./tmp/' + i + '.js', '// js!');
@justinbmeyer
justinbmeyer / jsmem.md
Last active June 29, 2024 16:00
JS Memory

JavaScript Code

var str = "hi";

Memory allocation:

Address Value Description
...... ...
@lancejpollard
lancejpollard / adapter.js
Last active December 12, 2015 01:09
Criteria for Generic Datastore API (tower internals)
function adapter(name) {
return adapter.instances[name] || (adapter.instances[name] = new AdapterClass(name));
}
adapter.instances = {};
function AdapterClass(name) {
this.name = name;
this.types = {};
this.mixins = [];
@lancejpollard
lancejpollard / potentialAdapterUsages.js
Last active December 12, 2015 01:18
Brain dumping on adapters.js
// associating properties from different apis with your model.
// say, by default if the associated fields are blank, it will
// fetch and save them from the service.
// `linkedIn.resume` has similar API meaning to `DS.attr('App.Company')`
adapter('linkedIn')
.resource('resume')
.mixin({
find: function(criteria, callback) {
// criteria ==
@thehydroimpulse
thehydroimpulse / index.html
Last active December 12, 2015 09:09
Splitting ember.js compilation on both the server (Node.js) and client-side. This would solve search engine crawling, speed, and some others. I also gota simple server side implementation. Had to port ember-view to node.js. things are still somewhat unstable. Some issues on the server : * Lack of Router * This means Controllers and Views are not…
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Fast Boot</title>
</head>
<body>
<!-- Main application template -->
<script type="text/x-handlebars" data-template-name="application">
Application Template - {{name}}