Skip to content

Instantly share code, notes, and snippets.

View slorber's full-sized avatar
🏠
Working from home

Sébastien Lorber slorber

🏠
Working from home
View GitHub Profile
@slorber
slorber / gist:7199403
Created October 28, 2013 15:54
Not an "ideal" solution because one thread is feeding, while another one is consuming the data fed by the 1st one. But this works fine for me and reduces a lot the memory footprint.
package com.xxx.xxx.http;
import com.ning.http.client.RequestBuilder;
import com.ning.http.client.providers.grizzly.FeedableBodyGenerator;
import com.ning.http.client.providers.grizzly.FeedableBodyGenerator.Feeder;
import com.ning.http.client.providers.grizzly.FeedableBodyGenerator.SimpleFeeder;
import com.ning.http.client.providers.grizzly.GrizzlyAsyncHttpProviderConfig.Property;
import com.ning.http.multipart.MultipartEncodingUtil;
import com.ning.http.multipart.MultipartRequestEntity;
import com.ning.http.multipart.Part;
@slorber
slorber / gist:7448862
Created November 13, 2013 13:10
Akka actor to watch FS changes
import akka.actor.{ ActorRef, ActorSystem, Props, Actor }
import java.nio.file._
import java.io.File
import scala.concurrent.duration._
import scala.collection.JavaConversions._
import scala.Some
case class WatchDirectory(path: Path,resursive: Boolean = true)
onEditorKeyUp: function(e) {
var intercepted = this.interceptKeyUpDownEventsForSuggestionView(e,false);
if ( !intercepted ) {
this.handleModifiedSuggestionsUnwrapping();
this.startAutosaveTimerIfWordKey(e);
// /!\ The suggestion dropdown must absolutely be bound to keyup (and not keydown)
// because the currently typed char is not yet inserted in the editor!
this.maybeShowSuggestionsDropdownView();
}
var browserify = require('browserify');
var gulp = require('gulp');
var gutil = require('gulp-util');
var handleErrors = require('../util/handleErrors');
var source = require('vinyl-source-stream');
var wrench = require('wrench');
var path = require('path');
var fs = require('fs');
var Stamples = React.createClass({
mixins: [ScrollbarNearBottomMixin],
NumberOfItemsParPage: 10,
propTypes: {
appState: React.PropTypes.object.isRequired,
updateAppState: React.PropTypes.func.isRequired
{
"_readableState":{
"highWaterMark":16384,
"buffer":[
],
"length":0,
"pipes":null,
"pipesCount":0,
"flowing":false,
var Spaces = React.createClass({
propTypes: {
appState: React.PropTypes.object.isRequired,
updateAppState: React.PropTypes.func.isRequired
},
// TODO temporary to fluidify the carousel swipes, probably not so good
shouldComponentUpdate: function(nextProps,nextState) {
'use strict';
var React = require("react/addons");
var Q = require("q");
var Main = require("components/layout/main");
var CurrentUserService = require("services/currentUserService");
var ApiRequestSessionHolder = require("repositories/utils/apiRequestSessionHolder");
var AppState = function() { };
AppState.prototype = {
updateAppState: function(updateFunction) {
console.debug("before updating:",this);
console.debug("before updating:",this.prototype.constructor);
console.debug("before updating:",this.constructor);
console.debug("before updating:",new this.constructor());
console.debug("before updating:",new this.prototype.constructor());
var AppState = function() { };
AppState.prototype = {
updateAppState: function(updateFunction) {
console.debug("before updating:",this);
console.debug("before updating:",this.constructor);
console.debug("before updating:",new this.constructor());
console.debug("before updating:",new this.prototype.constructor());
Preconditions.checkMandatoryParameter(updateFunction,"updateFunction is required");