Skip to content

Instantly share code, notes, and snippets.

keepscoding

Block or report user

Report or block keepscoding

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@cristobal
cristobal / machine-diskutil.sh
Last active Feb 12, 2019
Machine Diskutil to mount/unmont external volumes inside docker machines running on Virtualbox
View machine-diskutil.sh
#!/usr/bin/env sh
# @see http://stackoverflow.com/questions/30040708/how-to-mount-local-volumes-in-docker-machine
# @see https://github.com/boot2docker/boot2docker/blob/master/doc/FAQ.md
################################################################################
# Dependency Section #
# #
################################################################################
check_deps() {
## Make sure commands are available
@DanielaSfregola
DanielaSfregola / perfomance-script.scala
Last active Mar 29, 2016
A quick and dirty experiment to compare the performance of scala immutable collections (Seq, List, Vector) of integers when accessing randomly, appending, prepending an element. See article http://danielasfregola.com/2015/06/15/which-immutable-scala-collection.
View perfomance-script.scala
import scala.concurrent.duration._
import scala.util.Random
import collection.immutable.Seq
private def prettyPrint(text: String)(duration: Duration): Unit =
println(s"[$text] - ${duration}")
private def ranges(base: Int, n: Int): Seq[Range] = for {
@kidpixo
kidpixo / jupyter_shortcuts.md
Last active Oct 18, 2019
Keyboard shortcuts for ipython notebook 3.1.0 / jupyter
View jupyter_shortcuts.md

Disclaimer : I just copied those shortcuts from Jupyter Menú > Help > Keyboard Shortcuts, I didn't wrote them myself.

Check your current shortcuts in your Help, shortcuts coule have been modified by extensions or your past self.

Toc

Keyboard shortcuts

The IPython Notebook has two different keyboard input modes. Edit mode allows you to type code/text into a cell and is indicated by a green cell border. Command mode binds the keyboard to notebook level actions and is indicated by a grey cell border.

@tinusn
tinusn / Application.java
Last active Jan 9, 2016
Play Framework 2.3 - Java - CORS
View Application.java
package controllers;
import play.*;
import play.mvc.*;
public class Application extends Controller {
/*
* Define any extra CORS headers needed for option requests (see http://enable-cors.org/server.html for more info)
*/
@lpsBetty
lpsBetty / config.js
Last active Aug 27, 2018
Angular $httpProvider interceptor to handle requests and also cancels request on state change
View config.js
/**
* This array is needed for canceling requests when changing the state/route.
* @type {Array}
*/
var currentRequests = [];
/**
* Handles route changes.
*/
app.run(['$rootScope', function($rootScope) {
@abyx
abyx / angular-error-handling.js
Last active May 16, 2019
AngularJS HTTP Error Handling Mechanism
View angular-error-handling.js
var HEADER_NAME = 'MyApp-Handle-Errors-Generically';
var specificallyHandleInProgress = false;
angular.module('myApp').factory('RequestsErrorHandler', ['$q', function($q) {
return {
// --- The user's API for claiming responsiblity for requests ---
specificallyHandled: function(specificallyHandledBlock) {
specificallyHandleInProgress = true;
try {
return specificallyHandledBlock();
@sadache
sadache / gist:d357ced8f6c942bca81a
Last active Aug 29, 2015
Faster with much less memory consumption JSON object reader
View gist:d357ced8f6c942bca81a
def objectReader[T1,T2,T3,T4,R](t1: String, t2: String, t3: String, t4: String)(f: (T1,T2,T3,T4) => R)(implicit readsT1:Reads[T1], readsT2:Reads[T2], readsT3:Reads[T3], readsT4:Reads[T4]): Reads[R] = {
def orElse[A](a:A, default: =>A) = if(a!=null) a else default
Reads[R]{
case JsObject(fields) =>
var t1V:JsResult[T1] = null.asInstanceOf[JsResult[T1]]
var t2V:JsResult[T2] = null.asInstanceOf[JsResult[T2]]
@skroah
skroah / gist:9c22697521626c7b388b
Last active Oct 1, 2019
Reactive Systems Design
View gist:9c22697521626c7b388b

##Reactive System Design Links

#Articles and Papers

@Swind
Swind / unzip.scala
Last active Apr 22, 2018
[Unzip in Scala] #Scala #zip
View unzip.scala
import java.util.zip.ZipFile
import java.io.FileInputStream
import java.io.FileOutputStream
import scala.collection.JavaConversions._
import java.util.zip.ZipEntry
import java.io.InputStream
import java.io.OutputStream
import java.io.File
class ZipArchive {
You can’t perform that action at this time.