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 / sublime-settings.json
Last active October 24, 2016 07:26
My Sublime Settings for PHP Developer
{
"rulers": [80, 120],
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"show_encoding": true,
"show_line_endings": true,
"translate_tabs_to_spaces": true,
"trim_trailing_white_space_on_save": true,
"word_wrap": false
}
@krisanalfa
krisanalfa / rm-assets.php
Created June 15, 2015 13:55
Remove Assets Recursively
<?php
header('Content-type: text/plain');
set_time_limit(0);
if (!function_exists('recursive_rmdir')) {
/**
* Remove directory recursively.
*
* @param string $dirPath Directory you want to remove.
@krisanalfa
krisanalfa / Encrypt.php
Created July 24, 2015 07:20
Simple class to encrypt and decrypt something with AES 256 encryption. Support for padding too!
<?php
/**
* Simple class to encrypt and decrypt something with AES 256 encryption.
*
* @author Krisan Alfa Timur <krisan47@gmail.com>
*/
class Encrypt
{
/**
@krisanalfa
krisanalfa / config.m4.patch
Last active March 7, 2016 18:15
Patch to install pdo_oci. Read full description here: https://gist.github.com/krisanalfa/09b765bb95012cd36fbd
--- config.m4 2005-09-25 06:23:24.000000000 +0700
+++ config.m4.new 2015-10-02 15:42:52.000000000 +0700
@@ -8,15 +8,15 @@
PDO_OCI_VERSION=`grep '"ocommon"' $PDO_OCI_DIR/orainst/unix.rgs | sed 's/[ ][ ]*/:/g' | cut -d: -f 6 | cut -c 2-4`
test -z "$PDO_OCI_VERSION" && PDO_OCI_VERSION=7.3
elif test -f $PDO_OCI_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME.10.1; then
- PDO_OCI_VERSION=10.1
+ PDO_OCI_VERSION=10.1
elif test -f $PDO_OCI_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME.9.0; then
PDO_OCI_VERSION=9.0
@krisanalfa
krisanalfa / ResourceController.php
Last active March 1, 2016 18:26
In replied to Mulia Nasution as response to my work partner Syaifudin Latief.
<?php
namespace App\Http\Controllers\Cart;
use Illuminate\Support\Facades\View;
use App\Http\Requests\Cart\StoreRequest;
use Illuminate\Support\Facades\Redirect;
use App\Http\Requests\Cart\UpdateRequest;
use App\Cart\Persistances\Cart as Persistant;
use App\Cart\Repositories\Cart as Repository;
@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 / vmblock-9.0.2-5.0.2-3.12.patch
Created November 18, 2013 08:51
VMWare vmblock patch for 3.12 kernel. It's ony works for VMPlayer 5.0.2 or VMWare Workstation 9.0.2
diff -Naur a/linux/control.c b/linux/control.c
--- a/linux/control.c 2013-10-03 04:29:47.471339204 -0400
+++ b/linux/control.c 2013-10-03 04:31:56.607334636 -0400
@@ -283,7 +283,7 @@
int i;
int retval;
- name = getname(buf);
+ name = (char*)getname(buf)->name;
if (IS_ERR(name)) {
@krisanalfa
krisanalfa / PKGBUILD
Created October 31, 2013 10:10
eAccelerator PHP for Arch Linux
# Maintainer: Krisan Alfa Timur <krisan47@gmail.com>
pkgname=eaccelerator-git
pkgver=1.0
pkgrel=2
pkgdesc="A free open-source PHP accelerator, optimizer, and dynamic content cache."
arch=('i686' 'x86_64')
url="http://eaccelerator.net/"
license=('GPL')
depends=('php')
@krisanalfa
krisanalfa / eaccelerator.patch
Created October 31, 2013 09:56
eAccelerator Patch
--- eaccelerator.orig 2013-10-31 16:51:48.000000000 +0700
+++ eaccelerator.c 2013-10-31 16:52:20.000000000 +0700
@@ -63,7 +63,7 @@
#include "php.h"
#include "php_ini.h"
-#include "php_logos.h"
+/*#include "php_logos.h"*/
#include "main/fopen_wrappers.h"
#include "ext/standard/info.h"