Skip to content

Instantly share code, notes, and snippets.

View Igosuki's full-sized avatar

Guillaume Balaine Igosuki

View GitHub Profile
$(function() {
$("#fond").attr("src","./images/regions_"+ancre+"00.png");
var slider = $("#slider").slider({
value:0,
min:0,
max:65,
slide: function( event, ui ) {
var nombre = ("0" + ui.value).slice(-2)
$("#fond").attr("src","./images/regions_"+ancre+nombre+".png");
}
var kittens = angular.module("ngKitten", []);
kittens.directive('kittens', function factory() {
var kittensDirective = {
restrict: 'AC',
scope: false,
compile: function compile(tElement, tAttrs, transclude) {
return {
pre: function preLink(scope, element, attrs) {
element.attr('ng-src', 'http://placekitten.com/'+element.attr('width')+'/'+element.attr('height');
@Igosuki
Igosuki / README.md
Last active August 29, 2015 14:01
Publishing to a dump branch for bower

Supposing:

  • The artefact is built with grunt
  • The destination directory of the build is 'dist' and contains all necessary distribution files + bower.json
  • The destination branch is 'build'
  • The the current main branch is 'develop'

Otherwise simply replace accordingly

@Igosuki
Igosuki / push-build.sh
Created May 27, 2014 08:44
Push to a release branch
wat=`expr $(git status --porcelain 2>/dev/null| egrep "^(M| M)" | wc -l)`
#Stash if there are uncommited files
if [ $wat -gt "0" ]; then
git stash
fi
#Release workflow
git branch -D build;
git checkout -b build;
@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>