Skip to content

Instantly share code, notes, and snippets.

View flipjs's full-sized avatar
:octocat:
hjkl

Felipe Apostol flipjs

:octocat:
hjkl
View GitHub Profile
@flipjs
flipjs / .ackrc
Last active August 29, 2015 14:13 — forked from theaboutbox/.ackrc
--type-add=css=.sass,.less,.scss
--type-add=ruby=.rake,.rsel,.builder,.thor
--type-add=html=.haml,.html.erb,.html.haml
--type-add=js=.js.erb,.coffee
--type-set=cucumber=.feature
--type-set=c=.c,.cpp,.ino,.pde,.h
--ignore-dir=vendor
--ignore-dir=log
--ignore-dir=tmp
--ignore-dir=doc
@flipjs
flipjs / country-state.json
Created January 16, 2015 18:51
(JSON) List of countries and its states
[{
"country" : "Afghanistan",
"states" : "Badakhshan|Badghis|Baghlan|Balkh|Bamian|Farah|Faryab|Ghazni|Ghowr|Helmand|Herat|Jowzjan|Kabol|Kandahar|Kapisa|Konar|Kondoz|Laghman|Lowgar|Nangarhar|Nimruz|Oruzgan|Paktia|Paktika|Parvan|Samangan|Sar-e Pol|Takhar|Vardak|Zabol"
}, {
"country" : "Albania",
"states" : "Berat|Bulqize|Delvine|Devoll (Bilisht)|Diber (Peshkopi)|Durres|Elbasan|Fier|Gjirokaster|Gramsh|Has (Krume)|Kavaje|Kolonje (Erseke)|Korce|Kruje|Kucove|Kukes|Kurbin|Lezhe|Librazhd|Lushnje|Malesi e Madhe (Koplik)|Mallakaster (Ballsh)|Mat (Burrel)|Mirdite (Rreshen)|Peqin|Permet|Pogradec|Puke|Sarande|Shkoder|Skrapar (Corovode)|Tepelene|Tirane (Tirana)|Tirane (Tirana)|Tropoje (Bajram Curri)|Vlore"
}, {
"country" : "Algeria",
"states" : "Adrar|Ain Defla|Ain Temouchent|Alger|Annaba|Batna|Bechar|Bejaia|Biskra|Blida|Bordj Bou Arreridj|Bouira|Boumerdes|Chlef|Constantine|Djelfa|El Bayadh|El Oued|El Tarf|Ghardaia|Guelma|Illizi|Jijel|Khenchela|Laghouat|M'Sila|Mascara|Medea|Mila|Mostaganem|Naama|Oran|Ouargla|Oum e
@flipjs
flipjs / gist:8b263c3a6a6485bf0e07
Created December 29, 2014 00:34
Advice on NOT using semicolons in Javascript
"If you choose to omit semicolons where possible, my advice is to insert them immediately before the opening parenthesis or square bracket in any statement that begins with one of those tokens, or any which begins with one of the arithmetic operator tokens /, +, or - if you should happen to write such a statement." - Michael John Clement
@flipjs
flipjs / gist:35147cbc249d6003bcae
Created October 17, 2014 00:45
Install macvim with python (if for some reason brew wont install with python)
cd /System/Library/Frameworks/Python.framework/Versions
sudo mv Current Current-sys
sudo ln -s /usr/local/Cellar/python/2.8.x/Frameworks/Python.framework/Versions/2.7 Current
brew install macvim
sudo mv Current Current-brew
sudo mv Current-sys Current
<!-- index.html -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Angular App</title>
<!-- SCROLLS -->
<!-- load bootstrap and fontawesome via CDN -->
angular.module('app', [])
.service('UserService', function($http, $q) {
this.users = []
this.user = {}
function getData(obj, prop, id) {
var q = $q.defer()
var url = '/users/'
$http.get(url + id).success(function(response) {
obj[prop] = response
@flipjs
flipjs / gist:dbb0b136deecbdc7f4e3
Last active August 29, 2015 14:06
$scope.ctrl = this OR controllerAs?
// OLD STYLE OF CONTROLLER CONSTRUCTOR
;(function() {
angular.module('oldstyle', [])
.controller('MainController', MainCtrl)
function MainCtrl($scope) {
$scope.MainCtrl = this
this.users = {}
this.userList = []
@flipjs
flipjs / index.html
Last active August 29, 2015 14:06
Angular: bindToController
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Angular App</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
@flipjs
flipjs / app.js
Last active August 29, 2015 14:06
Angular: bindToController
/*=================================================
= Angular: bindToController =
=================================================*/
void (function(app) {
'use strict';
app.controller('ParentController', ParentCtrl)
@flipjs
flipjs / split-swap.vim
Last active August 29, 2015 14:05
VIM: Swap files between split windows
function! MarkWindowSwap()
let g:markedWinNum = winnr()
endfunction
function! DoWindowSwap()
"Mark destination
let curNum = winnr()
let curBuf = bufnr( "%" )
exe g:markedWinNum . "wincmd w"
"Switch to source and shuffle dest->source