Skip to content

Instantly share code, notes, and snippets.

Zidni Mubarock barockok

Block or report user

Report or block barockok

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
@jirikuncar
jirikuncar / README.md
Last active Aug 3, 2019
Traefik - header matching
View README.md

Traefik routing

Proxy to services based on Accept header.

Run

docker-compose up -d

Test

@danharper
danharper / gulpfile.js
Last active Dec 2, 2019
New ES6 project with Babel, Browserify & Gulp
View gulpfile.js
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var browserify = require('browserify');
var watchify = require('watchify');
var babel = require('babelify');
function compile(watch) {
var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel));
@OliverJAsh
OliverJAsh / bar-es6.js
Created Nov 13, 2014
sandboxed-module error with transitive ES6 deps
View bar-es6.js
export default 'bar';
@alieseparker
alieseparker / Floyd-Warshall
Last active Jan 1, 2018
Floyd-Warshall - Find shortest path
View Floyd-Warshall
# Floyd-Warshall Algorithm
## Introduction:
Finds Shortest Path (or longest path) among all pairs of nodes in a graph.
Complexity: O(|n|³)
## How does it work?
- There can be more than one route between two nodes.
- The number of nodes in the route isn’t important (Path 4 has 4 nodes but is shorter than Path 2, which has 3 nodes)
- There can be more than one path of minimal length
@barockok
barockok / veritrans_vtweb_activemerchant_snippet.rb
Last active Dec 24, 2015
Sample code for implementation vt-web with activemerchant
View veritrans_vtweb_activemerchant_snippet.rb
merchant_id = 'XXXXXXXXXXXXXXXXXXX'
merchant_hash_key = 'XXXXXXXXXXXXXXXXXXX'
# implemetation for generating form
payment_service_for @order.id, merchant_id, \
merchant_hash_key: merchant_hash_key,
service: :veritrans,
amount: @order.total_amount,
currency: 'IDR',
html: {:id => 'payment-form' , :authenticity_token => false } do |service|
@barockok
barockok / saad_al_ghamidi.rb
Last active Jun 10, 2016
Al-quran 30 Juz 114 surah downloader reciter : Saad Al Ghamidi
View saad_al_ghamidi.rb
require 'mechanize'
require 'nokogiri'
require 'active_support/all'
class SaadAlGhamidi
def initialize
@page_agent = Mechanize.new
@file_agent = Mechanize.new
@file_agent.pluggable_parser.default = Mechanize::Download
end
View gist:3444459
# no config
Time.now is localtime
1.second.from_now is UTC
Timestamp stored in UTC
AR not translated
Time.now: Fri Aug 24 10:22:25 +0930 2012
1.second.from_now 2012-08-24 00:52:26 UTC
@d11wtq
d11wtq / let.js
Created Aug 18, 2012
RSpec style let() in Jasmine/Mocha
View let.js
/**
* Get RSpec-style let() in your Mocha/Jasmine specs.
*/
var let = function (callback) {
var value, called = false;
var memoizer = function() {
if (called) {
return value;
} else {
called = true;
@linjian
linjian / deferred_garbage_collection_all_in_one.rb
Created Jul 19, 2012
Deferred Garbage Collection All in One
View deferred_garbage_collection_all_in_one.rb
# http://ariejan.net/2011/09/24/rspec-speed-up-by-tweaking-ruby-garbage-collection
#
# Usage:
# DEFER_GC=10 rspec spec/
# DEFER_GC=10 cucumber features/
#
# put it to spec/support/deferred_garbage_collection_all_in_one.rb
# or feature/support/hooks.rb
class DeferredGarbageCollection
DEFERRED_GC_THRESHOLD = (ENV['DEFER_GC'] || -1).to_f
@jrafanie
jrafanie / gist:3011499
Created Jun 28, 2012
ActiveRecord::Base doesn't serialize instance variables
View gist:3011499
~/Code/playground/rails-3-2-stable $ cat app/models/person.rb
class Person
attr_accessor :abc
end
~/Code/playground/rails-3-2-stable $ cat app/models/story.rb
class Story < ActiveRecord::Base
attr_accessor :abc
end
You can’t perform that action at this time.