Skip to content

Instantly share code, notes, and snippets.

View johan--'s full-sized avatar

johan pretorius johan--

View GitHub Profile
@johan--
johan-- / Gemfile
Created June 30, 2017 09:43 — forked from Joseph-N/Gemfile
File upload using dropzone.js, paperclip in rails. Tutorial link http://josephndungu.com/tutorials/ajax-file-upload-with-dropezonejs-and-paperclip-rails
source 'https://rubygems.org'
# default gems here
#---------------------------
# add paperclip and bootstrap
gem "paperclip", "~> 4.1"
gem 'bootstrap-sass', '~> 3.1.1'
@johan--
johan-- / README.md
Created June 21, 2017 13:46 — forked from jsanz/README.md
CartoDB.js examples: add sublayers

This example shows how to create a Leaflet map with a basemap and an empty CartoDB.js layer. Once the layer is created a function is attached the event of the layers selector checkboxes so on any state change, the sublayers are removed and recreated according to the user selection.

require 'cucumber'
require 'selenium-webdriver'
# require 'cukehub' # optional, but recommended. See cukehub.com for more details
caps = Selenium::WebDriver::Remote::Capabilities.chrome(chromeOptions: { binary: "/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary",
args: [ "--headless" ]})
Before do
@browser = Selenium::WebDriver.for :chrome, desired_capabilities: caps
end
@johan--
johan-- / README.md
Created March 27, 2017 16:13 — forked from jsanz/README.md
CartoDB.js examples: several createLayer

On this map we create two CartodB layers, one of them is built with two sublayers. In order to control when they are added to the map, we save the promises objects and use the jQuery.when function to execute the code to add the layers to the map when both promises are executed.

@johan--
johan-- / LICENSE.md
Created March 8, 2017 08:21 — forked from cbjuan/LICENSE.md
Stacked Bar Chart with Legend, Text Labels and Tooltips

The MIT License (MIT)

Copyright (c) 2015 Juan Cruz-Benito. http://juancb.es

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR I

@johan--
johan-- / index.html
Created November 23, 2016 13:23 — forked from mreddimasi/index.html
Angular and Pivot
<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<base href="/">
<title></title>
<style>
* {
font-family: Verdana;
}
.node {
border: solid 1px white;
font: 10px sans-serif;
line-height: 12px;
@johan--
johan-- / sample.js
Created October 14, 2016 13:05 — forked from chrisabrams/sample.js
Bluebird promise chain example
Promise = require('bluebird')
var A = function() {
return new Promise(function(resolve, reject) {
var result = 'A is done'
console.log(result)
resolve(result);
})
@johan--
johan-- / install.md
Created September 7, 2016 13:21 — forked from iandees/install.md
Installing and running Project OSRM, the OpenStreetMap-based routing engine, on an Amazon EC2 instance.

My goal here was the create a routable graph for Chicago.

I used Ubuntu 12.04LTS on an m2.4xlarge just to be sure memory wasn't too much of an issue.

Install

Start a screen session and start downloading an OSM extract (I used this extract of Illinois). In another screen I did the following:

  sudo apt-get update && sudo apt-get upgrade -y

sudo apt-get -y install git make cmake build-essential \

@johan--
johan-- / install.md
Created July 20, 2016 10:57 — forked from JanDintel/install.md
Install guide for Rspec, Guard, Spork, Cucumber and Mongoid

Install Cucumber with Rspec, Guard, Factory Girl(?) and Spork

Using during Hartl rails 4.0 guide (http://ruby.railstutorial.org/chapters)

Gems

group :development, :test
  gem 'guard-rspec'
  gem 'guard-livereload'
  gem 'spork-rails', github: 'sporkrb/spork-rails' # rubygems version not rails 4 compatible
  gem 'guard-spork'