Skip to content

Instantly share code, notes, and snippets.

View 0xjjpa's full-sized avatar
🔒
Hiding encrypted secrets

Jose Aguinaga 0xjjpa

🔒
Hiding encrypted secrets
View GitHub Profile
@0xjjpa
0xjjpa / angular.html
Created August 13, 2013 14:04
For Internet Explorer 7/8/9 >
<!DOCTYPE html>
<html lang="en" class="ng-app:myapp" id="ng-app" ng-app="myapp" xmlns:ng="http://angularjs.org">
<head>
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!--[if lte IE 8]>
<script>
document.createElement('ng-include');
document.createElement('ng-pluralize');
@0xjjpa
0xjjpa / httpBackend.js
Created August 3, 2013 21:27
Httpbackend methods for flushing on unit tests
afterEach(function() {
$httpBackend.flush();
$httpBackend.verifyNoOutstandingExpectation();
$httpBackend.verifyNoOutstandingRequest();
});
@0xjjpa
0xjjpa / karmaConfig.js
Created August 1, 2013 13:18
karmaConfig.js
var karmaConfig = function(configFile, customOptions) {
var options = { configFile: configFile, keepalive: true };
var travisOptions = process.env.TRAVIS && { browsers: ['Firefox'], reporters: 'dots' };
return grunt.util._.extend(options, customOptions, travisOptions);
};

Using Yeoman and Jade

Getting started

  • Make sure you have yo installed: npm install -g yo
  • Run: yo webapp
  • Install grunt-contrib-jade: npm install grunt-contrib-jade --save-dev

Customization

{
"manifest_version": 2,
"name": "Chrome Socket API Server",
"description": "listen & accept for socket",
"version": "0.1",
"app": {
"background": {
"scripts": ["server.js"]
}
},
{
"manifest_version": 2,
"name": "Chrome Socket API Server",
"description": "listen & accept for socket",
"version": "0.1",
"app": {
"background": {
"scripts": ["server.js"]
}
},
{
"manifest_version": 2,
"name": "Chrome Socket API Server",
"description": "listen & accept for socket",
"version": "0.1",
"app": {
"background": {
"scripts": ["server.js"]
}
},
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"
@0xjjpa
0xjjpa / population.js
Created March 10, 2013 03:04
Wrapper for data related to the age groups in the United States over the last 150 years. Retrieved from the Minnesota Population Center - http://ipums.org/
var population = [
{
"year": "1850",
"age": "0",
"sex": "1",
"people": "1483789"
},
{
"year": "1850",
"age": "0",
@0xjjpa
0xjjpa / binaryTree.js
Created February 16, 2013 16:42
Simple binary tree structure in a C-like syntax (no class, just node wrapper)
var Node = function(v, l, r) {
this.value = v; this.left = l || {}; this.right = r || {};
}
Node.prototype.addChildren = function(number) {
if(number) {
if(this.value) {
Node.prototype.parent = this;
if(this.value > number) {
Node.prototype.direction = "left";