Skip to content

Instantly share code, notes, and snippets.

View andidp's full-sized avatar

AndiDePe andidp

View GitHub Profile
@andidp
andidp / redis-server.sh
Last active August 29, 2015 14:14
Install redis dan php5-redis
#1 Install redis-server
sudo apt-get install redis-server
#2 Install php5-redis
sudo apt-get install php5-redis
#3 Restart apache2 server
sudo service apache2 restart
@andidp
andidp / redis_incr_decr_append.php
Last active August 29, 2015 14:15
php redis append, strlen, increment decrement
<?php
/**
* @author andidepe11@gmail.com
*/
// Instantiate Class Redis dan koneksikan php dengan redis
$redis = new Redis();
$redis->connect('127.0.0.1');
@andidp
andidp / array_literal.rb
Created February 15, 2015 22:18
Array Literal in Ruby
# Array literal
al = [1933, "Persib Juara ISL 2014", 11]
#Mengakses array dari kiri
al[0] #output => 1933
al[1] #output => "Persib Juara ISL 2014"
al[2] #output => 11
#Mengakses array dari kanan
al[-3] #output => 1933
@andidp
andidp / click_jquery.js
Created February 17, 2015 09:05
jquery click
<html>
<head>
<title>title</title>
<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
<script>
$(document).ready(function(){
$('#sel div a').click(function(){
console.log( this.rel );
@andidp
andidp / call_helper_in_controller.php
Last active November 28, 2022 15:22
Call Helper Function for using it on Controller in Cakephp 3
<?php
namespace App\Controller;
use App\Controller\AppController;
// Use Link Helper Class
use App\View\Helper\LinkHelper;
/**
* ProductCategories Controller
@andidp
andidp / link_helper.php
Created June 14, 2015 22:54
LinkHelper Grab From book.cakephp.org
@andidp
andidp / questions_and_answers.php
Created August 9, 2016 02:47
laravel migration file for creating questions and answers tables
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateQuestionsAndAnswersTables extends Migration
{
/**
* Run the migrations.
*
@andidp
andidp / questions_and_answers.txt
Created August 9, 2016 03:01
questions and answers tables
+------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+------------------+------+-----+---------+----------------+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| title | varchar(255) | NO | | NULL | |
| body | mediumtext | NO | | NULL | |
| created_at | timestamp | YES | | NULL | |
| updated_at | timestamp | YES | | NULL | |
+------------+------------------+------+-----+---------+----------------+
@andidp
andidp / QuestionsTableSeeder.php
Created August 9, 2016 04:08
Questions db seeder
<?php
use Illuminate\Database\Seeder;
class QuestionsTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
@andidp
andidp / AnswersTableSeeder.php
Created August 9, 2016 04:10
Answer Table Seeder
<?php
use Illuminate\Database\Seeder;
class AnswersTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void