Skip to content

Instantly share code, notes, and snippets.

View bobey's full-sized avatar

Olivier Balais bobey

View GitHub Profile
@bobey
bobey / generate_ssh_config.js
Created October 12, 2015 14:02
Generate a .ssh/config file from your EC2 instances
var AWS = require('aws-sdk');
AWS.config.update({region: 'eu-west-1'});
var ec2 = new AWS.EC2();
ec2.describeInstances({}, function(err, data) {
data.Reservations.forEach(function(reservation) {
reservation.Instances.forEach(function(instance) {
@bobey
bobey / clone-projets.sh
Last active January 12, 2016 15:05
Git clone ALL the Gitlab Projets of given namespace in one command
curl -sS https://gist.githubusercontent.com/bobey/2b09d2cc72fbcc8cf551/raw/get-gitlab-projets.php | \
php -- http://gitlab.com YOUR-PRIVATE-TOKEN your-namespace | \
xargs -n 1 git clone
#!/bin/bash
while [ l=l ]
do
#eject cdrom
eject
#pull cdrom track back in
eject -t
done
@bobey
bobey / dist_backup_script.sh
Last active August 29, 2015 14:05
Backup script
#!/bin/bash
# ----
#
# Script de backup serveur perso vers serveur distant
# Fonctionnemenent :
# 1. Targz de /var/www
# 2. Targz de /etc/apache2/sites-available
# 3. Dump de toutes les bases de données MySql
# 4. Zip du backup courant avec protection par mot de passe
@bobey
bobey / angular-controller.js
Last active August 29, 2015 14:03
Angular model with factory
/* @ngInject */
function GouzigouzaController($scope, Gouzigouza) {
$scope.gouzigouza = new Gougigouza({
code: 'CODE'
});
}
angular
.module('my.namespace.controllers')
@bobey
bobey / vimrc
Created March 14, 2014 10:38 — forked from bewiwi/vimrc
"Before : git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
"First run : :BundleInstall
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
Bundle 'scrooloose/nerdtree'
@bobey
bobey / ember data lazyLoadedHasMany.js
Created July 2, 2013 07:35
Emberjs & Ember-data lazy load one to many (1-n) relationships
DS.lazyLoadedHasMany = function(type, options) {
options = options || {};
return Ember.computed(function(key, value) {
var parts = this.constructor.toString().split('.'),
name = parts[parts.length - 1];
name = name[0].toLowerCase() + name.slice(1);
@bobey
bobey / Emberjs-multiples-panes-multiple-tabs.md
Created March 8, 2013 17:28
A solution to build an emberjs application around two panes, each one having multiple tabs.

Here is a solution to handle an application build around two panes, each one having multiple tabs.

The router is able to memorize the current tab selected in each pane:

  • /leftTab1/rightTab1
  • /leftTab1/rightTab2
  • /leftTab2/rightTab3
  • / ...

Here is the working associated fiddle: http://jsfiddle.net/obalais/L78yu/

@bobey
bobey / ember.js
Created March 1, 2013 11:42
PMSIpilot build
// Version: v1.0.0-pre.4-119-g32503f9
// Last commit: 32503f9 (2013-01-29 22:32:15 -0800)
(function() {
/*global __fail__*/
/**
Ember Debug
@bobey
bobey / gist:4977535
Created February 18, 2013 13:49 — forked from tomdale/gist:4263171

Read-Only

An important feature for Ember Data is providing helpful error messages when your application tries to do something that is forbidden by the data model.

To that end, we would like for the data model to be able to mark certain records, attributes, and relationships as read-only. This ensures that we can provide errors immediately, and not have to wait for a return trip from the adapter.

This also means that the adapter does not need to handle the case where an application developer inadvertently makes changes to a record that it does not conceptually make sense to modify on the client.

Requirements