Skip to content

Instantly share code, notes, and snippets.

View diorahman's full-sized avatar

Dhi Aurrahman diorahman

  • Cokelatia
  • Bandung
View GitHub Profile
@jordaaash
jordaaash / count.js
Last active June 19, 2021 13:03
Bookshelf.js/Knex.js innerJoin withRelated
var Promise = require('bluebird'),
User = require('./user'),
knex, query;
knex = User.prototype._builder(User.prototype.tableName);
query = function (q) {
q.distinct()
.innerJoin('orders', function () {
this.on('users.id', '=', 'orders.user_id')
@staltz
staltz / introrx.md
Last active May 15, 2025 10:37
The introduction to Reactive Programming you've been missing
cardinality 1 uses 5 bytes (0.00244140625 bits per register})
cardinality 10 uses 31 bytes (0.01513671875 bits per register})
cardinality 100 uses 271 bytes (0.13232421875 bits per register})
cardinality 1000 uses 1906 bytes (0.9306640625 bits per register})
cardinality 2000 uses 3517 bytes (1.71728515625 bits per register})
cardinality 3000 uses 4918 bytes (2.4013671875 bits per register})
cardinality 4000 uses 6129 bytes (2.99267578125 bits per register})
cardinality 5000 uses 7206 bytes (3.5185546875 bits per register})
cardinality 6000 uses 8099 bytes (3.95458984375 bits per register})
cardinality 7000 uses 8868 bytes (4.330078125 bits per register})
@soarez
soarez / ca.md
Last active April 24, 2025 12:51
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

#!/bin/bash
# Settings: edit these as needed
PROJECT_NAME="test"
OUTPUT_DIRECTORY="~/Documents/MapBox/export/"
# first change into TileMill code directory
cd /Applications/TileMill.app/Contents/Resources/
# hint: use http://bboxfinder.com/ to get bounds in lon/lat
@markjaquith
markjaquith / gist:7029068
Created October 17, 2013 17:37
How to get git-svn working in OS X Mavericks with Homebrew
sudo xcodebuild -license
xcode-select --install # There will be a GUI prompt
sudo cpan SVN::Core # use the "sudo" method when prompted
# Then add this to your ~/.profile:
# export PATH=/Library/Developer/CommandLineTools/usr/bin:$PATH
# Then probably:
brew reinstall git
brew reinstall subversion
@rclark
rclark / Issues.md
Last active July 9, 2024 20:16
Leaflet WMS + GetFeatureInfo

There are a bunch of reasons why this is convoluted, mostly in building the URL to make the request:

  1. You have to rely on an AJAX request, this example uses jQuery
  2. To make a GetFeatureInfo request, you must provide a BBOX for a image, and the pixel coordinates for the part of the image that you want info from. A couple of squirrely lines of Leaflet code can give you that.
  3. Output formats. The info_format parameter in the request. We don't know a priori which will be supported by a WMS that we might make a request to. See Geoserver's docs for what formats are available from Geoserver. That won't be the same from WMS to WMS, however.
  4. WMS services return XML docs when there's a mistake in the request or in processing. This sends an HTTP 200, which jQuery doesn't think is an error.
@amyreese
amyreese / gist:6207161
Created August 11, 2013 22:25
Travis CI config to build against Qt5.0 on Ubuntu 12.04. Requires installing a PPA and certain packages for qt5 support.
before_install:
- sudo add-apt-repository --yes ppa:ubuntu-sdk-team/ppa
- sudo apt-get update -qq
- sudo apt-get install -qq qt5-qmake qtbase5-dev qtdeclarative5-dev libqt5webkit5-dev libsqlite3-dev
script:
- qmake -qt=qt5 -v
- qmake -qt=qt5
- make
@creationix
creationix / randomlights.js
Created July 6, 2013 02:57
Talking to tinyduino over firmatta using johnny-five.
var five = require('johnny-five');
var board = new five.Board();
board.on("ready", function () {
var leds = new Array(5);
for (var i = 0; i < 5; i++) {
leds[i] = new five.Led({pin: i + 5});
}
@bodokaiser
bodokaiser / parser.cc
Last active December 16, 2015 04:38
Nodejs C++ Addon which takes buffer and does bit operations.
#include <v8.h>
#include <node.h>
#include <node_buffer.h>
#include <iostream>
using namespace v8;
Handle<Value> CalcHeadSize(const Arguments &args) {
HandleScope scope;