Skip to content

Instantly share code, notes, and snippets.

View abner's full-sized avatar

Ábner Silva de Oliveira abner

View GitHub Profile
@abner
abner / angularjs_directive_attribute_explanation.md
Created October 25, 2015 07:31 — forked from CMCDragonkai/angularjs_directive_attribute_explanation.md
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
@abner
abner / jasmine-this-vars.md
Created October 8, 2015 10:02 — forked from traviskaufman/jasmine-this-vars.md
Better Jasmine Tests With `this`

Better Jasmine Tests With this

On the Refinery29 Mobile Web Team, codenamed "Bicycle", all of our unit tests are written using Jasmine, an awesome BDD library written by Pivotal Labs. We recently switched how we set up data for tests from declaring and assigning to closures, to assigning properties to each test case's this object, and we've seen some awesome benefits from doing such.

The old way

Up until recently, a typical unit test for us looked something like this:

describe('views.Card', function() {
@abner
abner / grape.rake
Last active September 5, 2015 03:48 — forked from oivoodoo/routes.rake
rake task for printing grape routes.
namespace :grape do
desc "Grape API Routes"
task :routes => :environment do
mapped_prefix = '/api' # where mounted API in routes.rb
params_str = ' params:'
desc_limit = 45
route_info = Kanban::API.routes.map {|r| [r, r.instance_variable_get(:@options)] }
max_desc_size = route_info.map{|_,info| (info[:description] || '')[0..desc_limit].size }.max
max_method_size = route_info.map{|_,info| info[:method].size }.max
max_version_size = route_info.map{|_,info| info[:version].size }.max
@abner
abner / GitHooksChain.md
Last active May 26, 2016 08:19
Git Hooks Chain

Instructions

  1. Add the hook-chain script to the repository hooks

  2. Create a link symbolic to hook-chain with the name of the hook which will be chained

  • Eg: post-receive -> hook-chain
  1. Add scripts prefixed with the [hookname].
@abner
abner / docker_static_ip.sh
Last active August 26, 2015 04:55 — forked from andreyserdjuk/docker_static_ip.sh
docker static ip
# in case of conflict with local nginx:
# make sure in all *.confs (
# also in default and example to avoid error like
# 'nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)'
# )
# set for instance "listen 127.0.0.1:80" instead of "listen *:80"
# docker & network settings
DOCKER_IMAGE_NAME="abner/postgresql" # build of nginx-php - for example
DOCKER_CONTAINERS_NAME="nginx_bridged" # our container's name
@abner
abner / nfs-tunnel.md
Last active August 29, 2015 14:27 — forked from proudlygeek/nfs-tunnel.md
Mount NFS Folder via SSH Tunnel

1. Install NFS on Server

Install the required packages (Ubuntu 12.04):

apt-get install nfs-kernel-server portmap

2. Share NFS Folder

Open the exports file:

vim /etc/exports
@abner
abner / SAC PKGBUILD.sh
Last active August 29, 2015 14:26 — forked from rexcze-zz/SAC PKGBUILD.sh
SAC package
# Maintainer: Jakub Bittner
pkgname=SAC
pkgver=8.1
pkgrel=2
pkgdesc="eToken PKI client"
arch=('i686')
url="http://www.safenet.com"
license=('custom')
depends=('pcsclite')
makedepends=('libarchive>=2.4.12' 'unzip')
@abner
abner / app.ts
Last active August 29, 2015 14:25 — forked from scottmcarthur/app.ts
Angular Typescript Rest Resource
/// <reference path="angular.d.ts" />
/// <reference path="angular-resource.d.ts" />
interface IEmployee extends ng.resource.IResource<IEmployee>
{
id: number;
firstName : string;
lastName : string;
}
interface IEmployeeResource extends ng.resource.IResourceClass<IEmployee>
var module = angular.module( 'my.resource', [ 'ngResource' ] );
module.factory( 'Resource', [ '$resource', function( $resource ) {
return function( url, params, methods ) {
var defaults = {
update: { method: 'put', isArray: false },
create: { method: 'post' }
};
methods = angular.extend( defaults, methods );
(function(settings, libraries) {
localStorage.setItem('settings', JSON.stringify(settings));
localStorage.setItem('libraries', JSON.stringify(libraries));
setTimeout(function() {
window.location = window.location; // Force refresh
}, 0);
})(
//Settings
{
"panels": [