Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Hello, mister!

Krisan Alfa Timur krisanalfa

:octocat:
Hello, mister!
View GitHub Profile
@krisanalfa
krisanalfa / return.php
Created Feb 7, 2014
How return walk in PHP
View return.php
<?php
$error = false;
function a() {
global $error;
$error = true;
var_dump('a');
}
@krisanalfa
krisanalfa / mongooo.sh
Created Feb 20, 2014
Export your Mongo database. Each collection has it's own .json file. So, we can import them later using this script.
View mongooo.sh
#!/bin/sh
exportDb() {
echo "Exporting $1"
echo "db.getCollectionNames()" |
mongo $1 2> /dev/null |
grep '"' |
cut -d '"' -f 2 |
while read a; do
if [[ $a != "system.indexes" ]]; then
View .gitignore
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@krisanalfa
krisanalfa / SuperContainer.php
Created May 2, 2014
Container which has ability to automatic resolve dependency, injecting dependency, etc
View SuperContainer.php
<?php
class BindingResolutionException extends Exception {}
class SuperContainer implements ArrayAccess {
protected $resolved = array();
protected $bindings = array();
protected $instances = array();
View ArrayHelper.php
<?php
class ArrayHelper
{
public static function except($attributes, $hidden)
{
return array_diff_key($attributes, array_flip((array) $hidden));
}
public static function isEmpty($array)
@krisanalfa
krisanalfa / .gitignore
Last active Aug 29, 2015
Basic Gitignore File
View .gitignore
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@krisanalfa
krisanalfa / 02.make
Created Nov 12, 2014
Homebrew error build HHVM HEAD on Yosemite
View 02.make
2014-11-12 23:14:09 +0700
make
-j4
Scanning dependencies of target fastlz
[ 0%] Scanning dependencies of target afdt
Building C object third-party/fastlz/CMakeFiles/fastlz.dir/fastlz.c.o
[ 0%] Building C object third-party/libafdt/CMakeFiles/afdt.dir/src/lowlevel.c.o
Scanning dependencies of target pcre
@krisanalfa
krisanalfa / iTerm.md
Created Dec 18, 2014
Tutorial git-bisect
View iTerm.md
krisanalfatimur@supernova ~/Temp/test (git)-[master] % git log --oneline
c470042 [ADD] New method to determine the number of cigarrete.
6ab57ea [ERROR] Here's an error has been introduced.
f12ef84 [UPDATE] New words.
3f1a4b3 [UPDATE] Now say hello!
3df8afb [UPDATE] Assign the function to variable.
867b7da [NEW] hello.php.
krisanalfatimur@supernova ~/Temp/test (git)-[master] %
krisanalfatimur@supernova ~/Temp/test (git)-[master] % php hello.php
@krisanalfa
krisanalfa / tint2rc
Created Mar 20, 2015
My tint2 Configuration
View tint2rc
# Tint2 config file
# Generated by tintwizard (http://code.google.com/p/tintwizard/)
# For information on manually configuring tint2 see http://code.google.com/p/tint2/wiki/Configure
# Background definitions
# ID 1
rounded = 0
border_width = 1
background_color = #2D2D2D 100
border_color = #484848 100
@krisanalfa
krisanalfa / pas.json
Created Mar 26, 2015
pas config for MySQL
View pas.json
{
"name": "xinix-technology/generalli",
"version": "1.0.0",
"profile": "docker",
"docker": {
"containers": {
"nginx": {
"ports": [
"80:80"