Skip to content

Instantly share code, notes, and snippets.

View arnaudbreton's full-sized avatar

Arnaud Breton arnaudbreton

View GitHub Profile
@arnaudbreton
arnaudbreton / rsync-auto grunt alternative.coffee
Last active March 25, 2020 04:45
Gruntfile to trigger new Vagrant 1.5 rsync command when catching changes. Faster than Vagrant rsync-auto bundled command, mainly because Grunt only watches specified paths while Guard/Listen (used internally by Vagrant) watches the whole (sub)-folders.
terminal = require('color-terminal')
log = (error, stdout, stderr, cb) ->
if error
terminal.color('red').write stdout
else
terminal.color('green').write stdout
cb()
@arnaudbreton
arnaudbreton / gist:5327394
Created April 6, 2013 19:54
AngularJS directive for bootstrap-switch
<div class="switch switch-small" bootstrap-switch="sync">
<input id="syncswitch" type="checkbox" />
</div>
module.directive('bootstrapSwitch', function() {
return {
restrict:'A',
scope: {
sync: true
},
@arnaudbreton
arnaudbreton / mention-twitter.js
Created May 30, 2014 09:22
Mention tweet feed
/*
*---------------------------------------------------------------
* Twitter
*---------------------------------------------------------------
*/
(function($, undefined){
"use strict";
var MentionApp = MentionApp || {};
@arnaudbreton
arnaudbreton / spec.js
Created November 21, 2013 15:37
Sinon.js + Backbone : jQuery deferred are never trigerred
TestModel = Backbone.Model.extend({
url: '/test'
});
describe ('Model', function () {
it('should be able to change password (fake server)', function() {
var model, promise, request, server;
server = sinon.fakeServer.create();
@arnaudbreton
arnaudbreton / switch-evernote-production.sh
Last active December 26, 2015 02:39
Switch Evernote production <=> sandbox
# Switch to production
defaults delete com.evernote.Evernote
defaults write com.evernote.Evernote noteStoreURL https://www.evernote.com/edam/note
defaults write com.evernote.Evernote userStoreURL https://www.evernote.com/edam/user
@arnaudbreton
arnaudbreton / remove.sh
Created October 17, 2013 07:54
Remove MySQL from OSX
# Source: http://johnmcostaiii.net/2011/removing-mysql-osx-lion/
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
rm -rf ~/Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /var/db/receipts/com.mysql.*
@arnaudbreton
arnaudbreton / gist:5752427
Last active December 18, 2015 08:09
Providing a custom thumbnail for a Google Drive app.
html2canvas(document.getElementById('editor'),
{
onrendered: function (canvas) {
doc.dirty = false;
// doc.info is the File structure
var data = angular.extend({}, doc.info);
if (doc.info.editable) {
data.content = doc.info.content;
data.thumbnail = {
// Base 64 URL friendly
@arnaudbreton
arnaudbreton / controllers.js
Created April 16, 2013 19:15
AngularJS Share controller invoking drive-share
controllersModule.controller('ShareCtrl', ['$scope','appId','doc', function($scope, appId, doc) {
var client = new gapi.drive.share.ShareClient(appId);
$scope.enabled = function () {
return doc.info.id != null;
};
$scope.share = function () {
client.setItemIds([doc.info.id]);
client.showSettingsDialog();
}
}]);
@arnaudbreton
arnaudbreton / AngularJS Overlay controller
Created March 21, 2013 13:31
A simple AngularJS controller to make an overlay
---
HTML
---
<div id="overlay" class="sign-in" ng-controller="OverlayCtrl" ng-show="loading">
<div class="loading">
<img src="/img/loading.gif">
</div>
</div>
@arnaudbreton
arnaudbreton / AngularJS overlay controller
Created March 21, 2013 13:30
A simple controller for an overlay
---
HTML
---
<div id="overlay" class="sign-in" ng-controller="OverlayCtrl" ng-show="loading">
<div class="loading">
<img src="/img/loading.gif">
</div>
</div>