Skip to content

Instantly share code, notes, and snippets.

View Igosuki's full-sized avatar

Guillaume Balaine Igosuki

View GitHub Profile
@Igosuki
Igosuki / README.md
Last active August 29, 2015 14:02
Best MEAN Grunt/Gulp/Yo Generators
@Igosuki
Igosuki / gist:4e4c7c711547d8048df5
Created June 26, 2014 15:46
Create piecharts data
#!/usr/local/bin/node
var pg = require('pg');
var moment = require('moment');
var knex = require('knex')({
client: 'pg',
connection: {
host: '127.0.0.1',
user: 'front',
@Igosuki
Igosuki / radioactive
Created July 17, 2014 11:26
Make bootstrap buttons radioactive
$colors: (primary: $brand-primary, success: $brand-success, info: $brand-info, warning: $brand-warning, danger: $brand-danger);
$radioactive-shadow: #333 !default;
$ratioactive-shadow-base: 0 0 9px;
$ratioactive-shadow-extended: 0 0 18px;
@each $color-name, $color in $colors {
$animation-name: $color-name;
@-webkit-keyframes #{$animation-name} {
from { background-color: $color; -webkit-box-shadow: $ratioactive-shadow-base $radioactive-shadow; }
50% { background-color: lighten($color, 15); -webkit-box-shadow: $ratioactive-shadow-extended lighten($color, 15); }
@Igosuki
Igosuki / ng_sub_method.coffee
Last active August 29, 2015 14:04
Manage passing data to sub templates without a service
angular.element(document).ready ->
@mymodule = angular.module 'mymodule'
@mymodule.config [() ->
angular.extend angular, {
isPromise: (promise) ->
promise && (promise.then || promise.$then || (promise.$promise && promise.$promise.then))
}
]
@mymodule.controller 'SomeSubController', () ->
if (promiseFn = angular.isPromise($scope.polymorphicObj))
@Igosuki
Igosuki / gitstats.sh
Created July 30, 2014 20:05
Git stats
#!/bin/sh
AUTHOR=$1
function gitstats {
git log --author="$1" --oneline --numstat --pretty=tformat: --after=$2 --before=$3 | sort -f | uniq -c | sort -n
}
function gitlines {
git log --author="$1" --pretty=tformat: --numstat --after=$2 --before=$3 | gawk '{ add += $1 ; subs += $2 ; loc += $1 - $2 } END { printf "added lines: %s removed lines : %s total lines: %s\n",add,subs,loc }' -
angular.module 'wat'
.directive 'bindServerErrors', ($compile, $timeout) ->
errorTemplate = """
<div><ul><li ng-repeat='(k,v) in errors'>{{k}}: {{v.join(',')}}</li></ul></div>
"""
restrict: 'A'
template: """
<span tooltip-html-unsafe='{{errorsHtml}}' tooltip-placement="top" tooltip-append-to-body="true">
<span ng-transclude></span>
</span>
@Igosuki
Igosuki / radial.html
Created September 21, 2014 16:21
Static Radial Progress
<div class="wrap">
<div class="progress-radial progress-25">
<div class="overlay">25%</div>
</div>
<div class="progress-radial progress-50">
<div class="overlay">50%</div>
</div>
@Igosuki
Igosuki / duration.rb
Last active August 29, 2015 14:06
Pass-through struct to deserialize an API into YAML
class Duration < Struct.new(:value, :quantity)
def method_missing id, *args
raise "Illegal Duration" if !value.is_a?(Numeric) || ![:years, :days, :weeks, :months, :hours, :minutes, :seconds].include?(quantity.to_sym)
value.send(quantity.to_sym).send(id.id2name.to_sym)
end
end
@Igosuki
Igosuki / main.go
Created January 26, 2015 20:43
Go Examples
package main
import (
"fmt"
"os"
)
const n = 500000000
func main() {
@Igosuki
Igosuki / Dockerfile
Last active August 29, 2015 14:26
Tiny docker image and go runtime
FROM centurylink/ca-certs
MAINTAINER Travis Reeder "[email protected]"
EXPOSE 8080
WORKDIR /app
# copy binary into image
COPY hello /app/
ENTRYPOINT ["./hello"]