Skip to content

Instantly share code, notes, and snippets.

View fer-ri's full-sized avatar

Ferri Sutanto fer-ri

  • Purwokerto, Indonesia
View GitHub Profile
<?php
$extensions = get_loaded_extensions();
if( is_array($extensions) && sizeof($extensions) ) {
natcasesort($extensions);
foreach($extensions as $ext) {
echo "$ext <br />";
}
}
?>
sudo apt-get update && apt-get install git-core curl build-essential openssl libssl-dev
git clone https://github.com/joyent/node.git
cd node
# 'git tag' shows all available versions: select the latest stable.
git checkout enter-a-version
# Configure seems not to find libssl by default so we give it an explicit pointer.
# Optionally: you can isolate node by adding --prefix=/opt/node
@fer-ri
fer-ri / server.js
Created February 26, 2014 15:13 — forked from hatched/server.js
var http = require('http'),
path = require('path'),
fs = require('fs'),
util = require('util');
http.createServer(_handler).listen(3000);
console.log('Server running at http://127.0.0.1:3000/');
function _handler(req, res) {
@fer-ri
fer-ri / token.html
Last active August 29, 2015 13:56 — forked from songz/token.html
<script src="http://code.jquery.com/jquery-1.8.3.min.js" type="text/javascript"></script>
<script src="https://raw.github.com/carlo/jquery-base64/master/jquery.base64.min.js" type="text/javascript"></script>
<script src="http://crypto-js.googlecode.com/svn/tags/3.0.2/build/rollups/hmac-sha1.js"></script>
<script type="text/javascript">
var secondsInDay = 86400;
// Credentials
var apiKey = '<apiKey>';
var secret = '<secret>';
var sessionId = '1_MX4xMTMzMTg5Mn4xMjcuMC4wLjF-U3VuIERlYyAwMiAwNjo0NTozMSBQU1QgMjAxMn4wLjQwMjY2OH4';
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"
var http = require('http'),
fileJSON = require('./images.json'),
fs = require('node-fs'),
options,
assets = fileJSON.imageArr;
options = {
host: 'url.com',
port: 80,
path: 'path/to/images'
@fer-ri
fer-ri / macros
Created June 27, 2014 08:14 — forked from mnshankar/macros
<?php
/*********************************************************************************************
* Example usage (In view)
* <div class="welcome">
<?php echo Form::open(array('route'=>'process','class'=>'form-horizontal'))?>
<?php echo Form::textField('first_name')?>
<?php echo Form::textField('last_name')?>
<?php echo Form::emailField('email')?>
<?php echo Form::passwordField('password')?>
<?php echo Form::selectField('select_one', array('1'=>'abc', '2'=>'def'))?>
<?php
use Illuminate\Console\Command;
use Illuminate\Filesystem\Filesystem;
class ViewsCommand extends Command {
/**
* The console command name.
*
* @var string

Vagrant Setup

This tutorial guides you through creating your first Vagrant project.

We start with a generic Ubuntu VM, and use the Chef provisioning tool to:

  • install packages for vim, git
  • create user accounts, as specified in included JSON config files
  • install specified user dotfiles (.bashrc, .vimrc, etc) from a git repository

Afterwards, we'll see how easy it is to package our newly provisioned VM

@fer-ri
fer-ri / hello-node.js
Last active August 29, 2015 14:05 — forked from nf/hello-node.js
var cluster = require('cluster');
var http = require('http');
var numCPUs = require('os').cpus().length;
if (cluster.isMaster) {
// Fork workers.
for (var i = 0; i < numCPUs; i++) {
cluster.fork();
}
cluster.on('exit', function(worker, code, signal) {