Skip to content

Instantly share code, notes, and snippets.

View yllieth's full-sized avatar
🇨🇦

Sylvain RAGOT yllieth

🇨🇦
View GitHub Profile
@yllieth
yllieth / ps1.sh
Created April 17, 2014 15:36
Unix prompt (with git support)
# Customize BASH PS1 prompt to show current GIT repository and branch.
# by Mike Stewart - http://MediaDoneRight.com
# SETUP CONSTANTS
# Bunch-o-predefined colors. Makes reading code easier than escape sequences.
# I don't remember where I found this. o_O
# Customized from http://mediadoneright.com/content/ultimate-git-ps1-bash-prompt
# Reset
@yllieth
yllieth / http-status-codes.js
Last active August 29, 2015 14:01
List most used HTTP status codes
var HTTP = {
// SUCCESS
OK : 200,
CREATED : 201,
ACCEPTED : 202,
NO_CONTENT : 204,
// REDIRECTION
MOVED_PERMANENTLY : 301,
MOVED_TEMPORARY : 302,
# declare new submodule
~/projets/dashboard$ git submodule add git@github.com:PredicSis/ui.git app/styles/ui
# Install a project with a submodule already defined
~/projets$ git clone git@github.com:yllieth/dashboard.git
~/projets/dashboard$ git submodule init
~/projets/dashboard$ git submodule update
@yllieth
yllieth / uploadDirective.js
Last active August 29, 2015 14:08
S3 direct upload with angularJS and fineuploader
angular.module("hub.upload")
.directive("fineUploaderS3", function($compile, $interpolate, $translate, baseUrl) {
return {
restrict: "A",
replace: true,
link: function($scope, element, attrs) {
var wrapper = document.getElementById("upload-s3")
new qq.s3.FineUploader({
@yllieth
yllieth / extension.js
Created November 6, 2014 10:59
Angular filter to extract extension from a file
angular.module('tools.filter')
.filter('extension', function() {
return function(input) {
return input.split('.').pop()
};
});
@yllieth
yllieth / app.js
Last active August 29, 2015 14:10
AngularJS templates
angular
.module('myHubApp', [...])
.factory('apiRestangular', function(Restangular, baseUrl) {
return Restangular.withConfig(function(RestangularConfigurer) {
RestangularConfigurer.setBaseUrl(baseUrl.API);
});
})
.factory('api', function(apiRestangular) {
return {
one: function(resource, id) {
@yllieth
yllieth / 1-setup.sh
Last active August 29, 2015 14:11
Angular dependencies graph
sudo apt-get install graphviz
npm install grunt-angular-modules-graph --save-dev
npm install grunt-graphviz --save-dev
// angular version
angular
.module('predicsis.tools.urlParser')
.factory('urlParser', function () {
function urlParser(url) {
var parser = document.createElement('a'), searchObject = {}, queries, split, i;
// Let the browser do the work
parser.href = url;
@yllieth
yllieth / mixins.scss
Last active June 16, 2016 06:46
Foudation utility generator
// A row with fixed height, background-color and text-color. Useful to create topbars of footers
@mixin banner($bg: $body-background, $color: $body-font-color, $height: $banner-height) {
height: $height;
line-height: $height;
background-color: $bg;
color: $color;
};
// Fine positionning mixin. Useful to align rebellious elements
@mixin offset($size, $origin: top) {
@yllieth
yllieth / promise-all.js
Last active April 25, 2017 22:20
Catching error in chained promises
function fn1(previous) {
console.log('previous: ' + previous, 'current: step1');
return Promise.resolve('step1');
}
function fn2(previous) {
console.log('previous: ' + previous, 'current: step2');
return Promise.reject('step2');
}