Skip to content

Instantly share code, notes, and snippets.

View hengkiardo's full-sized avatar

Hengki Sihombing hengkiardo

  • Jakarta, Indonesia
View GitHub Profile
@hengkiardo
hengkiardo / app.sh
Last active August 29, 2015 14:14 — forked from anonymous/app.sh
#!/bin/sh
#
# chkconfig: 35 99 99
# description: Node.js app server script
#
. /etc/rc.d/init.d/functions
USER="root"
#include <unistd.h>
#include <mach/mach.h>
#include <mach/mach_vm.h>
#include <mach-o/dyld.h>
int
main (int argc, char * argv[])
{
volatile char * library;
const mach_vm_size_t page_size = getpagesize ();
@hengkiardo
hengkiardo / es.sh
Last active August 29, 2015 14:18 — forked from Globegitter/es.sh
cd ~
##If you want to install OpenJDK
#sudo apt-get update
#sudo apt-get install openjdk-8-jre-headless -y
###Or if you want to install Oracle JDK, which seems to have slightly better performance
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
@hengkiardo
hengkiardo / rot13
Created April 16, 2015 06:45
Encodes and decodes strings into the ROT13 format (rotation of the 26 characters of the alphabet by 13 positions)
String.prototype.rot13 = function(){
return this.replace(/[a-zA-Z]/g, function(c){
return String.fromCharCode((c <= "Z" ? 90 : 122) >= (c = c.charCodeAt(0) + 13) ? c : c - 26);
});
};
@hengkiardo
hengkiardo / redis.markdown
Created September 24, 2015 15:23 — forked from bdotdub/redis.markdown
Running redis using upstart on Ubuntu

Running redis using upstart on Ubuntu

I've been trying to understand how to setup systems from the ground up on Ubuntu. I just installed redis onto the box and here's how I did it and some things to look out for.

To install:

@hengkiardo
hengkiardo / javascriptMD5.js
Created June 27, 2012 05:32
MD5 With JavaScript
var MD5 = function (string) {
function RotateLeft(lValue, iShiftBits) {
return (lValue<<iShiftBits) | (lValue>>>(32-iShiftBits));
}
function AddUnsigned(lX,lY) {
var lX4,lY4,lX8,lY8,lResult;
lX8 = (lX & 0x80000000);
lY8 = (lY & 0x80000000);
@hengkiardo
hengkiardo / growImage.js
Created July 30, 2012 08:30
Grow Image when Hover
function growImage() {
$('a.idea-link').each(function () {
var oheight = $(this).children(0).height();
var owidth = $(this).children(0).width();
var nheight = (oheight + (oheight * 0.25));
var nwidth = (owidth + (owidth * 0.25));
var top = ((oheight - nheight) / 2);
var left = ((owidth - nwidth) / 2);
$(this).mouseenter(function () {
$(this).css('z-index', '2').children(0).css('z-index', '3').stop().animate({
@hengkiardo
hengkiardo / controller.php
Created September 4, 2012 11:24 — forked from og-shawn-crigger/controller.php
Valums AJAX File Uploader for CodeIgniter
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Ajax_uploader extends CI_Controller {
// ------------------------------------------------------------------------
/**
* Array of allowed file extensions to upload.
*
* @var array
@hengkiardo
hengkiardo / jqcookies.js
Created September 6, 2012 08:57
Jquery Cookie
(function ($, document, undefined) {
var pluses = /\+/g;
function raw(s) {
return s;
}
function decoded(s) {
return decodeURIComponent(s.replace(pluses, ' '));
}
$.cookie = function (key, value, options) {
@hengkiardo
hengkiardo / index.html
Created September 21, 2012 09:12 — forked from mfkp/index.html
mailchimp ajax signup form example
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="jquery.ketchup.all.min.js" type="text/javascript"></script>
</head>
<body>
<div id="email">
<span>Enter your email to sign up</span>
<form action="/subscribe.php" id="invite" method="POST">