Skip to content

Instantly share code, notes, and snippets.

View antonioaguilar's full-sized avatar

Antonio Aguilar antonioaguilar

  • United States
View GitHub Profile
@antonioaguilar
antonioaguilar / index.html
Created November 6, 2015 12:00 — forked from anonymous/index.html
Angular Promises Example Angular Promises Example // source http://jsbin.com/yiqahe
<!DOCTYPE html>
<html ng-app="app">
<head>
<meta name="description" content="Angular Promises Example">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular.min.js"></script>
<meta charset="utf-8">
<title>Angular Promises Example</title>
</head>
<body ng-controller="MessageCtrl">
<h1>Angular Promises Example</h1>
@antonioaguilar
antonioaguilar / index.html
Created November 8, 2015 18:29 — forked from anonymous/index.html
JavaScript Filter, Map and ForEach Example // source http://jsbin.com/nimatu
<!DOCTYPE html>
<html ng-app="app">
<head>
<script src="https://cdn.rawgit.com/lodash/lodash/3.0.1/lodash.min.js"></script>
<script src="https://rawgit.com/angular/bower-angular/master/angular.min.js"></script>
<meta charset="utf-8">
<title>JavaScript Filter, Map and ForEach Example</title>
</head>
<body>
@antonioaguilar
antonioaguilar / example.html
Created December 6, 2015 00:08 — forked from schmuli/example.html
A simple AngularJS service for handling the 'onbeforeunload' event
<!DOCTYPE html>
<html data-ng-app="TestApp">
<head>
<script src="http://code.angularjs.org/1.2.9/angular.js"></script>
<script>
angular.module('TestApp', [])
.factory('beforeUnload', function ($rootScope, $window) {
// Events are broadcast outside the Scope Lifecycle
@antonioaguilar
antonioaguilar / Component.js
Created December 22, 2015 13:15 — forked from demetriusnunes/Component.js
Concise component definition for AngularJS 1.x
'use strict';
angular.module('Component', [])
.factory('Component', function () {
return function(bindings, template, linkFn, options) {
var directive = {
scope: parseBindings(bindings),
template: parseTemplate(template),
link: linkFn
@antonioaguilar
antonioaguilar / uri.js
Created January 9, 2016 10:18 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@antonioaguilar
antonioaguilar / getQueryParams.js
Created January 9, 2016 18:02 — forked from ryoppy/getQueryParams.js
Parse query string. use Underscore.js.
/**
* Parse query string.
* ?a=b&c=d to {a: b, c: d}
* @param {String} (option) queryString
* @return {Object} query params
*/
getQueryParams: function(queryString) {
var query = (queryString || window.location.search).substring(1); // delete ?
if (!query) {
return false;
@antonioaguilar
antonioaguilar / ec2_instance_create_and_setup.sh
Created February 17, 2016 16:23 — forked from Pablosan/ec2_instance_create_and_setup.sh
A bash script that will set up a new EC2 instance and ssh into it.
#!/bin/bash
# Authorize TCP, SSH & ICMP for default Security Group
#ec2-authorize default -P icmp -t -1:-1 -s 0.0.0.0/0
#ec2-authorize default -P tcp -p 22 -s 0.0.0.0/0
# The Static IP Address for this instance:
IP_ADDRESS=$(cat ~/.ec2/ip_address)
# Create new t1.micro instance using ami-cef405a7 (64 bit Ubuntu Server 10.10 Maverick Meerkat)
@antonioaguilar
antonioaguilar / .gitconfig
Created February 29, 2016 11:24 — forked from pksunkara/config
Sample of git config file (Example .gitconfig)
[user]
name = Pavan Kumar Sunkara
email = [email protected]
[core]
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
excludesfile = ~/.gitignore
[sendemail]
smtpencryption = tls
smtpserver = smtp.gmail.com
@antonioaguilar
antonioaguilar / tiny-template-engine.js
Last active April 3, 2016 17:31 — forked from anonymous/index.html
Tiny Template Engine
// tiny template engine function
function tpl(str,obj) {
for(var key in obj) {
str=str.replace(new RegExp('{' + key + '}','g'), obj[key]);
}
return str;
}
// code example
console.clear();
@antonioaguilar
antonioaguilar / rxjs_event_emitter.js
Created April 16, 2016 00:32 — forked from bangedorrunt/rxjs_event_emitter.js
Pub Sub pattern with RxJS
// Reference from: https://github.com/Reactive-Extensions/RxJS/blob/master/doc/howdoi/eventemitter.md
var hasOwnProp = {}.hasOwnProperty;
function createName (name) {
return '$' + name;
}
function Emitter() {
this.subjects = {};