Skip to content

Instantly share code, notes, and snippets.

Hengki Sihombing hengkiardo

  • Jakarta, Indonesia
Block or report user

Report or block hengkiardo

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
@hengkiardo
hengkiardo / jstz.js
Created Nov 27, 2012
Automatic Timezone Detection Using JavaScript
View jstz.js
var jstz = function() {
var b = function(a) {
a = -a.getTimezoneOffset();
return null !== a ? a : 0
}, c = function() {
return b(new Date(2010, 0, 1, 0, 0, 0, 0))
}, f = function() {
return b(new Date(2010, 5, 1, 0, 0, 0, 0))
}, e = function() {
var a = c(),
@hengkiardo
hengkiardo / url-get
Created Apr 29, 2013
Read URL GET variables with Javascript
View url-get
function getUrlVars() {
var vars = {};
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
vars[key] = value;
});
return vars;
}
/// http://hengkiardo.com/index.php?id=123&page=home
@hengkiardo
hengkiardo / README.md
Created Apr 27, 2019 — forked from magnetikonline/README.md
CloudFormation example for an API Gateway endpoint calling a Lambda function using proxy integration.
View README.md

CloudFormation example for API Gateway integration to Lambda function

Template that will create the following:

  • API Gateway endpoint:
    • A single root method, accepting POST requests only with Lambda proxy integration to a function.
  • In-line Lambda function echoing back requesting users IP address to API Gateway requests:
    • IAM role for Lambda allowing CloudWatch logs access.
    • Permissions for Lambda that allow API Gateway endpoint to successfully invoke function.
  • CloudWatch logs group for Lambda, with 90 day log retention.

After standing up the template, you should be able to curl a POST request to the URL listed as the apiGatewayInvokeURL output value.

@hengkiardo
hengkiardo / domain-list.json
Created Oct 29, 2018
Cross-language temporary (disposable/throwaway) email detection library. Covers 5228+ fake email providers.
View domain-list.json
["0-mail.com","0815.ru","0clickemail.com","10minutemail.com","20minutemail.com","2prong.com","30minutemail.com","3d-painting.com","4warding.com","4warding.net","4warding.org","60minutemail.com","amilegit.com","anonbox.net","anonymbox.com","antispam.de","beefmilk.com","binkmail.com","bio-muesli.net","bobmail.info","bofthew.com","brefmail.com","bsnow.net","bugmenot.com","bumpymail.com","cosmorph.com","courrieltemporaire.com","cubiclink.com","curryworld.de","cust.in","dacoolest.com","dandikmail.com","dayrep.com","deadaddress.com","despam.it","devnullmail.com","discardmail.com","discardmail.de","disposemail.com","dispostable.com","dodgeit.com","dodgit.com","dodgit.org","donemail.ru","dontreg.com","dontsendmespam.de","dump-email.info","dumpyemail.com","e4ward.com","email60.com","emailigo.de","emailinfive.com","emailmiser.com","emailsensei.com","emailtemporario.com.br","emailwarden.com","emailx.at.hm","fakeinbox.com","fakeinformation.com","fastacura.com","filzmail.com","fizmail.com","fr33mail.info","get1mail.com","
View express_with_jwt.js
var express = require('express')
, jwtMiddleware = require('express-jwt')
, bodyParser = require('body-parser')
, cookieParser = require('cookie-parser')
, cors = require('cors');
// We pass a secret token into the NodeJS process via an environment variable.
// We will use this token to sign cookies and JWTs
var SECRET_TOKEN = process.env.SECRET_TOKEN;
@hengkiardo
hengkiardo / countdown.css
Created Dec 26, 2012
A beautiful CSS/JS countdown clock
View countdown.css
/* Reset */
* {
margin: 0;
padding: 0;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-o-box-sizing: border-box;
box-sizing: border-box;
}
@hengkiardo
hengkiardo / convert-array.js
Created Oct 3, 2012
Convert simple array into two-dimensional array(matrix) in javascript
View convert-array.js
function listToMatrix(list, elementsPerSubArray) {
var matrix = [], i, k;
for (i = 0, k = -1; i < list.length; i++) {
if (i % elementsPerSubArray === 0) {
k++;
matrix[k] = [];
}
matrix[k].push(list[i]);
}
return matrix;
@hengkiardo
hengkiardo / goto-sublime
Created Nov 11, 2017 — forked from kendellfab/goto-sublime
Add mouse click `goto definition` in sublime text 3.
View goto-sublime
Linux - create "Default (Linux).sublime-mousemap" in ~/.config/sublime-text-3/Packages/User
Mac - create "Default (OSX).sublime-mousemap" in ~/Library/Application Support/Sublime Text 3/Packages/User
Win - create "Default (Windows).sublime-mousemap" in %appdata%\Sublime Text 3\Packages\User
[
{
"button": "button1",
"count": 1,
"modifiers": ["ctrl"],
"press_command": "drag_select",
@hengkiardo
hengkiardo / money-format.js
Created Sep 21, 2012
JavaScript Money Format
View money-format.js
Number.prototype.formatMoney = function(places, symbol, thousand, decimal) {
places = !isNaN(places = Math.abs(places)) ? places : 2;
symbol = symbol !== undefined ? symbol : "$";
thousand = thousand || ",";
decimal = decimal || ".";
var number = this,
negative = number < 0 ? "-" : "",
i = parseInt(number = Math.abs(+number || 0).toFixed(places), 10) + "",
j = (j = i.length) > 3 ? j % 3 : 0;
return symbol + negative + (j ? i.substr(0, j) + thousand : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + thousand) + (places ? decimal + Math.abs(number - i).toFixed(places).slice(2) : "");
@hengkiardo
hengkiardo / gist:9129379
Created Feb 21, 2014
How to prefetch video/audio files for uninterrupted playback in HTML5 video/audio
View gist:9129379
function e(id) {
return document.getElementById(id);
}
function loaded(blob_uri) {
// Clear progress indicator.
var container = e("container");
container.innerHTML = "";
var v = document.createElement("video");
v.src = blob_uri;
You can’t perform that action at this time.