View apache-alias.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<VirtualHost *:80> | |
ServerName example.com | |
ServerAlias www.example.com | |
ServerAdmin admin@example.com | |
DocumentRoot /var/www | |
ErrorLog ${APACHE_LOG_DIR}/error.log | |
CustomLog ${APACHE_LOG_DIR}/access.log combined |
View backup-shell.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
folder_name=/home/backup/databases/$(date +%Y)/$(date +%Y%m)/"$(date +%Y-%m-%d)-$(date +%H:%M)" | |
mkdir -p $folder_name && cd $folder_name | |
mysql -N -e 'show databases' | | |
while read dbname; | |
do | |
if [ $dbname != "mysql" ] && [ $dbname != "information_schema" ] && [ $dbname != "performance_schema" ] && [ $dbname != "sys" ] | |
then | |
mysqldump --complete-insert --routines --triggers --single-transaction "$dbname" > "$dbname".sql; | |
[[ $? -eq 0 ]] && gzip "$dbname".sql; |
View dynamic_url
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (isset($_SERVER['HTTP_HOST']) && $_SERVER["SCRIPT_NAME"]) { | |
$root = (isset($_SERVER["HTTPS"]) ? "https://" : "http://") . $_SERVER['HTTP_HOST']; | |
$root = $root . str_replace(basename($_SERVER["SCRIPT_NAME"]), "", $_SERVER["SCRIPT_NAME"]); | |
} else { | |
$root = 'localhost/absent'; | |
} |
View sandbox.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE `activities` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`title` varchar(45) DEFAULT NULL, | |
PRIMARY KEY (`id`) | |
); | |
INSERT INTO `activities` VALUES (1,'Act 1'),(2,'Act 2'); | |
CREATE TABLE `activity_details` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, |
View simple_array.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$data = [ | |
[ | |
'no_transaction' => '001', | |
'items' => [ | |
['name' => 'Milk', 'total' => 4], | |
['name' => 'Coffee', 'total' => 2], | |
] | |
], |
View data.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$data = [ | |
[ | |
'id' => 1, | |
'title' => 'Alice in wonderland', | |
'year' => '1993' | |
], | |
[ | |
'id' => 2, |
View dynamic_func.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$words = ['dibawakan', "dimakan", "menangis"]; | |
$list = ['bawa', 'makan']; | |
$complete = []; | |
$functions = ['trim_prefix', 'trim_suffix', 'trim_another_affix']; | |
function trim_prefix($word){ | |
if(preg_match('/^(di|[ks]e)/', $word)){ |
View MainActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Sketch Project Studio | |
* Created by Angga 20/04/2016 19:32 | |
*/ | |
public class MainActivity extends AppCompatActivity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); |
View Validator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.sketchproject.infogue.modules; | |
import android.util.Log; | |
import java.text.DateFormat; | |
import java.text.ParseException; | |
import java.text.SimpleDateFormat; | |
import java.util.Locale; | |
/** |
View AppHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.graphics.Bitmap; | |
import android.graphics.drawable.BitmapDrawable; | |
import android.graphics.drawable.Drawable; | |
import java.io.ByteArrayOutputStream; | |
/** | |
* Sketch Project Studio | |
* Created by Angga on 12/04/2016 14.27. | |
*/ | |
public class AppHelper { |