Skip to content

Instantly share code, notes, and snippets.

View nurrony's full-sized avatar

Nur Rony nurrony

View GitHub Profile
@nurrony
nurrony / app.js
Created September 7, 2016 17:20 — forked from brianfeister/app.js
Angular Upload with Image Crop
angular.module('cropAndUpload', [
'angularFileUpload',
'ngImgCrop'
])
@nurrony
nurrony / multi-layout.js
Created September 29, 2016 14:23
React Starter Kit
export const createRoutes = (store) => ({
path: '/',
component: BaseLayout,
childRoutes: [
{
component: CoreLayout,
childRoutes: [
CounterRoute(store)
]
},
@nurrony
nurrony / latency.markdown
Created November 10, 2016 08:06 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@nurrony
nurrony / redmine gitlab sync
Created November 17, 2016 07:37 — forked from jakimowicz/redmine gitlab sync
simple (and dirty) sync between redmine issues and gitlab issues
#!/usr/bin/env ruby
require 'faraday'
require 'json'
require 'gitlab'
module Redmine
Host = nil
APIKey = nil
@nurrony
nurrony / nginx.conf
Created December 20, 2016 05:15 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@nurrony
nurrony / array_iteration_thoughts.md
Created January 14, 2017 15:30 — forked from ljharb/array_iteration_thoughts.md
Array iteration methods summarized

While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.

Intro

JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it much simpler to think about both the old list and the new one, what they contain, and

@nurrony
nurrony / change-referrer.demo.phantom.js
Created February 9, 2017 10:10 — forked from papoms/change-referrer.demo.phantom.js
Try to overwrite window.document.referrer from within phantomjs / onInitialized
var page = require('webpage').create();
page.onConsoleMessage = function (msg) {
console.log('From Page Console: '+msg);
};
page.onInitialized = function() {
page.evaluate(function () {
"use strict";
//The Referrer we want to set
@nurrony
nurrony / handler.js
Created March 28, 2017 12:10 — forked from jonascheng/handler.js
AWS Lambda blueprint cloudwatch-alarm-to-slack
'use strict';
/**
* Follow these steps to configure the webhook in Slack:
*
* 1. Navigate to https://<your-team-domain>.slack.com/services/new
*
* 2. Search for and select "Incoming WebHooks".
*
* 3. Choose the default channel where messages will be sent and click "Add Incoming WebHooks Integration".

Quick Steps to Configure Amazon AutoScaling

Setup Environment and Credentials

aptitude install openjdk-6-jre-headless
cat <<-ACCESS > <PATH_TO_CREDENTIAL_FILE>
AWSAccessKeyId=<YOUR_KEY_ID>

AWSSecretKey=

@nurrony
nurrony / aws-facebook-php.template
Created March 28, 2017 12:31 — forked from sjoonk/aws-facebook-php.template
AWS Facebook PHP template
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Launch your Facebook applications within minutes. This template will create a Facebook Stack and configure a social file sharing sample application that upload files to Amazon S3 and notifies your friends by posting it on your wall. **WARNING** This template takes advantage of the AWS Free Usage Tier and if you are eligible since it creates one or more Amazon EC2 instances and a Elastic Load balancer. You will be billed for the AWS resources used.",
"Parameters": {
"AppURL": {
"Default": "http://aws-facebook.s3.amazonaws.com/aws-facebook-php-v2.tar.gz",
"Description": "URL of the application to be deployed",
"Type": "String"