Skip to content

Instantly share code, notes, and snippets.

View alissonbovenzo's full-sized avatar
:electron:
In code we trusth

Alisson Desandro Bovenzo alissonbovenzo

:electron:
In code we trusth
View GitHub Profile
@btroncone
btroncone / authentication.ts
Last active April 10, 2022 06:44
Angular 2 application role access decorator, wrapping built in CanAccess functionality. Prevents view transitions when user roles are not appropriate.
import { Injectable } from 'angular2/core';
import { Storage } from './storage';
import { CurrentUser } from '../interfaces/common';
@Injectable()
export class Authentication{
private _storageService : Storage;
private _userKey : string = "CURRENT_USER";
constructor(storageService : Storage){
/**
*
* @package Validator
* @author FelipeBarros<felipe.barros.pt@gmail.com> [2015-05-04]
*
**/
'use strict';
/* REFERENCE: http://stackoverflow.com/a/1187628 */
var array_diff = function(a1, a2) {
@demetriusnunes
demetriusnunes / angularExtensions.js
Last active August 29, 2015 14:04
Extending $q promises with a .set method
angular.module("myApp")
.config(function ($provide) {
$provide.decorator('$q', function($delegate) {
var defer = $delegate.defer;
$delegate.defer = function() {
var deferred = defer();
deferred.promise.set = function(object, property) {
return deferred.promise.then(function(value) {
object[property] = value;
@edmondburnett
edmondburnett / gist:40e7db34416fdc734846
Last active April 17, 2019 16:21
Push-to-Deploy, Python edition - git post-receive hook script
#!/usr/bin/env python
# post-receive hook for git-based deployments
import sys
import os
from subprocess import call
# configuration
deploy_to_path = '/path/to/deploy/directory/'
deploy_branch = 'master'
@rdeavila
rdeavila / git-update-fork.sh
Last active February 19, 2024 16:02
Git: como atualizar um fork com as mudanças do original?
#!/bin/bash
# Adicione um novo remote; pode chamá-lo de "upstream":
git remote add upstream https://github.com/usuario/projeto.git
# Obtenha todos os branches deste novo remote,
# como o upstream/master por exemplo:
git fetch upstream