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 | |
function showView($view, $data = null) | |
{ | |
$CI = get_instance(); | |
$CI->load->view('commons/layouts/header', $data); | |
$CI->load->view($view, $data); | |
$CI->load->view('commons/layouts/footer', $data); | |
} | |
function showJsonView($data, $status = 200) | |
{ |
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
var HaversineHelper = { | |
getQueryString: function | |
( | |
latitiude, | |
longitude, | |
keywords | |
){ | |
return "SELECT id, post_id, full_name, description, (6371 * acos(cos(radians($latitude)) * cos(radians(latitude)) * cos(radians(longitude) - radians(longitude)) + sin(radians(latitude)) * sin(radians(latitude)))) distance FROM wp_locations WHERE full_name LIKE '%$keywords%' OR description LIKE '%keywords%' GROUP BY full_name HAVING distance < $distance ORDER BY distance LIMIT 0, 20"; | |
} | |
}; |
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(!defined('BASEPATH')) exit('No direct script access allowed.'); | |
function debug($data, $forceExit = TRUE) | |
{ | |
echo '<pre>'; | |
print_r($data); | |
echo '</pre>'; | |
if(TRUE === $forceExit) exit; | |
} | |
function debugStackTrace() | |
{ |
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
/** @license MIT License (c) 2011,2012 Copyright Tavendo GmbH. */ | |
/** | |
* AutobahnJS - http://autobahn.ws | |
* | |
* A lightweight implementation of | |
* | |
* WAMP (The WebSocket Application Messaging Protocol) - http://wamp.ws | |
* | |
* Provides asynchronous RPC/PubSub over WebSocket. |
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
sudo vim /etc/default/beanstalkd # change IP to 0.0.0.0 | |
sudo systemctl daemon-reload # reload daemon | |
netstat -nat | grep LISTEN # see if `0.0.0.0:11300` is in the list |
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 | |
class Event { | |
private static $events = []; | |
public static function listen($name, $callback) { | |
self::$events[$name][] = $callback; | |
} | |
public static function trigger($name, $argument = null) { | |
foreach (self::$events[$name] as $event => $callback) { |
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 | |
#sudo ln -s /full-path/git-log-live /usr/local/bin/git-log-live | |
#sudo chmod +x git-log-live | |
#git-log-live /absolute-proj-root-path | |
#git-log-live . | |
while : | |
do | |
clear |
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 namespace App\Services\Enums; | |
final class LogType | |
{ | |
const | |
//Total failures. Major systems are unavailable. | |
EMERGENCY_UNUSABLE_SYSTEMS = 'emergency', | |
//Usable hardwares with unusal outputs such as website down, unavailable DBs. | |
ALERT_CORRUPTED_SYSTEMS = 'alert', |
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
#Main proj. | |
#Add a submodule. | |
git submodule add https://proj.git | |
#Go to submodule's dir and change to specific branch. | |
cd submodule_dir | |
git checkout -b branch origin/branch | |
#Go back to proj root and push to repo along with the new submodule's new branch. | |
git add . -u | |
git commit ... | |
git push |
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
Ref: | |
https://www.digitalocean.com/community/tutorials/how-to-remove-docker-images-containers-and-volumes | |
Remove all: | |
docker system prune -a | |
Images: | |
Remove all: | |
docker rmi $(docker images -a -q) |
OlderNewer