Skip to content

Instantly share code, notes, and snippets.

@roparz
roparz / routes.coffee
Last active August 29, 2015 14:04
AngularJS route builder that avoid declaration duplication
_build = (callback) ->
string = callback.toString()
mathes = string.match /function\s?\(([\w,\s?\$]+)\)\s?\{/
arr = mathes[1].split(', ')
arr.push callback
return arr
# using AngularUI Router
angular.module('app').config ($stateProvider) ->
@roparz
roparz / aws-s3-rename.coffee
Created July 23, 2014 09:36
Rename object with Node.js AWS S3 (copy object then delete object) with promises
config = require 'config'
s3 = require 's3'
q = require 'q'
module.export = (oldKey, newKey) ->
defer = q.defer()
params =
# you need to set the s3 bucket in the CopySource key
CopySource: "#{ config.s3.bucket }/#{ oldKey }"
@roparz
roparz / .gitconfig
Last active April 18, 2019 09:27
Git config
[alias]
st = status
ci = commit
co = checkout
br = branch
rz = reset --hard HEAD
unwip = reset HEAD^
pr = pull --rebase
pf = push --force-with-lease
cp = cherry-pick
@roparz
roparz / cg-contenteditable.coffee
Last active August 29, 2015 14:25
cg-contenteditable - AngularJS directive to manage contenteditable element (in CoffeeScript)
angular.module('whatever').directive 'cgContenteditable', ->
restrict: 'A'
scope:
ngModel: '='
link: (scope, elem, attrs) ->
elem = elem[0]
# 1
elem.setAttribute 'contenteditable', true
# 2
@roparz
roparz / check-css.js
Last active August 29, 2015 14:25
gulp-sniffer - check css exemples
var gulp = require('gulp'),
sniffer = require('gulp-sniffer');
var sniffs = {
'Use lighter|normal|bold instead of 100-900 for font-weight': function(content) {
return content.match(/font-weight: \d+/);
}
}
gulp.task('check-css', function() {
@roparz
roparz / check-tabs.js
Created July 26, 2015 18:24
gulp-sniffer - check tabs exemple
'This file uses tabs instead of spaces for indentation': function(content) {
return content.match(/\t/g);
}
@roparz
roparz / .zshrc
Created October 18, 2017 15:41
Git log stay displayed
export LESS="-RFX"
@roparz
roparz / keybase.md
Created March 20, 2018 21:52
keybase.md

Keybase proof

I hereby claim:

  • I am roparz on github.
  • I am roparz (https://keybase.io/roparz) on keybase.
  • I have a public key ASAiDnGuW_Q9XWixNgCkZTyFbpdszw0JTuPPxQq56l6S2go

To claim this, I am signing this object:

@roparz
roparz / README.md
Last active June 13, 2018 17:09
Pull-request merge process

Pull-request merge process

When it's a fix or feature branch

If I consider that all commits of the branch are good (well named, concerns correctly separated) then I use the Rebase and merge option. All commits are merge into develop as is without creating a merge commit (they are put just after the last commit in develop).

In the other hand, if there are "Work in progress" (WIP) commits in the branch, or if I consider that all commits refer to the same fix/feature and should be grouped, I use the Squash and merge option. All commits are grouped in one commit and put in develop (still without creating a merge commit). The commit will default take the name of the pull-request but you can change it if needed.