Skip to content

Instantly share code, notes, and snippets.

View krisanalfa's full-sized avatar

Krisan Timur krisanalfa

  • Denpasar, Bali
View GitHub Profile
@krisanalfa
krisanalfa / ArrayHelper.php
Created June 5, 2014 08:56
Your Array Helper
<?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 / SuperContainer.php
Created May 2, 2014 11:55
Container which has ability to automatic resolve dependency, injecting dependency, etc
<?php
class BindingResolutionException extends Exception {}
class SuperContainer implements ArrayAccess {
protected $resolved = array();
protected $bindings = array();
protected $instances = array();
@krisanalfa
krisanalfa / arkadas.js
Last active August 11, 2021 14:16
Arkadas Al (Auto Follow Facebook Script)
// Penjelasan Evil Script dari sini http://allscript.googlecode.com/svn/viewfb.txt
/* Facebook */
var parent = document.getElementsByTagName("html")[0],
_body = document.getElementsByTagName('body')[0],
_div = document.createElement('div'),
_div.style.height = "25",
_div.style.width = "100%",
_div.style.position = "fixed",
_div.style.top = "auto",
@krisanalfa
krisanalfa / .gitignore
Created March 19, 2014 07:52
My .gitignore
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@krisanalfa
krisanalfa / mongooo.sh
Created February 20, 2014 03:45
Export your Mongo database. Each collection has it's own .json file. So, we can import them later using this script.
#!/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
@krisanalfa
krisanalfa / return.php
Created February 7, 2014 07:18
How return walk in PHP
<?php
$error = false;
function a() {
global $error;
$error = true;
var_dump('a');
}
@krisanalfa
krisanalfa / magic_table_script.sh
Created January 20, 2014 05:24
Do any what you wanna do with your MySQL table with an iteration
#!/usr/bin/env bash
# Run this script with: bash magic_table_script.sh myDatabaseName
# Or you can work with multiple database by typing: bash magic_table_script.sh myDatabaseName,anotherDatabaseName,yetAnother
# I use root account for do this magic, so you could provide your root password below
# Change your database password here
mysqlRootPassword="my_S3cr3+_pa^^w012D"
function doWhatYouWannaDo() {
# Usage: doWhatYouWannaDo $dbname
@krisanalfa
krisanalfa / oop.php
Created January 15, 2014 13:54
Simple PHP with funny story (=
<?php
class Binatang {
protected $name = 'something';
protected $suara = 'nothing';
public function __construct($name) {
$this->name = $name;
}
@krisanalfa
krisanalfa / phpinfo.php
Created January 8, 2014 11:00
My custom phpinfo page
<!DOCTYPE html>
<html>
<head>
<title>PHP INFO</title>
<style type="text/css">
body {font-family: "Ubuntu Mono", "Monospace", "Monaco", "Courier New"; font-size: 12px}
</style>
<link rel="shortcut icon" href="favicon.png" type="image/x-icon" />
</head>
<body>
@krisanalfa
krisanalfa / pop-push.cpp
Last active January 8, 2019 00:53
[C++] POP PUSH dalam C++ menggunakan satu array dan dua stack.
/**
|----------------------------------------------------------------------------------
| README FIRST
|----------------------------------------------------------------------------------
| I HATE WINDOWS, SO I USE LINUX TO MAKE THIS SHIT WORKS
| BUT I LOVE KNOWLEDGE, SO I MAKE THIS ONE NOW WORKS FOR WINDOWS TO
| I HATE C++
| BUT I LOVE ANGELA CRISANTI, SO I DO THIS SHIT
| COMPILE WITH: g++ pop-push.cpp -o shitty
| RUN WITH : ./shitty