Skip to content

Instantly share code, notes, and snippets.

View gieart87's full-sized avatar

Sugiarto gieart87

View GitHub Profile
@gieart87
gieart87 / pagination.ctp
Created July 2, 2012 03:31 — forked from slywalker/pagination.ctp
pagination element for CakePHP on twitter bootstrap
<?php
if (!isset($modules)) {
$modulus = 11;
}
if (!isset($model)) {
$models = ClassRegistry::keys();
$model = Inflector::camelize(current($models));
}
?>
<div class="pagination">
@gieart87
gieart87 / backupdb.sh
Created January 26, 2016 14:19
Backup MySQL databases into separated files and exclude some databases defined
#!/bin/bash
USER="root"
PASSWORD="root"
OUTPUT="/home/backup-dir"
rm "$OUTPUT/*gz" > /dev/null 2>&1
databases=`mysql --user=$USER --password=$PASSWORD -e "SHOW DATABASES;" | tr -d "| " | grep -v Database`
@gieart87
gieart87 / config
Created February 21, 2016 03:38
Deploy Rails App in Sub Directory with Nginx + Ubuntu 14.04
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name example.com;
location / {
passenger_enabled on;
rails_env development;
root /var/www/rails/my_app/public;
}
{
"message": "Not Found",
"url": "/bot/viglink/cakeviglink/api/categories.json?page=2",
"code": 404,
"trace": [
{
"file": "/var/www/html/bot/viglink/cakeviglink/vendor/cakephp/cakephp/src/Controller/Controller.php",
"line": 688,
"function": "paginate",
"class": "Cake\\Controller\\Component\\PaginatorComponent",
@gieart87
gieart87 / gist:69c781700267fa314bfcb4259d6e5869
Created August 9, 2016 02:47
Rails : Override Mime Type and Respond Default Format in Controller
# force as xml when params[:format] isn't present
request.format = 'xml'.to_sym if params[:format].nil?
@gieart87
gieart87 / codeigniter.conf
Last active June 25, 2020 09:34
Nginx Virtual Host Config for CodeIgniter 3.x in Mac / OSX Sierra
server {
listen 80;
server_name localhost;
root /Users/user/html/codeigniter/;
location / {
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
@gieart87
gieart87 / default
Created February 20, 2017 03:11
Setting Virtual Host (Nginx + PHP7) on Mac OSX El Capitan
server {
listen 80;
server_name localhost;
root /Users/user/gieart/nginx;
access_log /usr/local/etc/nginx/logs/default.access.log;
location / {
index index.html index.htm index.php;
}
@gieart87
gieart87 / pubnub_client.html
Created March 14, 2017 04:05
Sample Client Subscriber PubNub Realtime Notification
<!doctype html>
<html>
<head>
<title>PubNub Simple Chat Room Demo</title>
<script src="http://cdn.pubnub.com/pubnub.min.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.1.1/css/bootstrap.min.css">
</head>
<body>
@gieart87
gieart87 / gist:bfee0b0b78c58a7f3f23ee754be0a6f0
Created March 22, 2017 01:22
Fixing Error only_full_group_by when executing a query grouping in MySql
[mysqld]
# ... other stuff will probably be here
sql_mode = "STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
@gieart87
gieart87 / gist:6ac5324436b5b5b60ec1c164e9fc6464
Created March 27, 2017 09:31
Download All Web Pages from a Website Using wget
wget --recursive --no-clobber --page-requisites --html-extension --convert-links --restrict-file-names=windows --random-wait --domains example.com --no-parent www.example.com