Skip to content

Instantly share code, notes, and snippets.

<?php
function showUser() {
$user = $this->model->getUserById(1);
echo $user->name;
echo $user->email;
echo $user->phone;
}
@triswan
triswan / daemon.cpp
Created October 7, 2018 12:20 — forked from alexdlaird/daemon.cpp
Useful as a starting point for a C++ based Linux daemon application.
#include <dirent.h>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <iostream>
#include <stdlib.h>
#include <string>
#include <sys/stat.h>
#include <syslog.h>
@triswan
triswan / sample.php
Created June 8, 2018 04:05 — forked from theskumar/sample.php
Docblock Comment standards
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* Short description for file
*
* Long description for file (if any)...
*
* PHP version 5
@triswan
triswan / keyup_delay.js
Created March 4, 2018 01:11 — forked from chensoren/keyup_delay.js
Jquery keyup delay
var delay = (function(){
var timer = 0;
return function(callback, ms){
clearTimeout (timer);
timer = setTimeout(callback, ms);
};
})();
$('input').keyup(function() {
@triswan
triswan / youtube api video category id list
Last active November 17, 2017 07:42 — forked from dgp/youtube api video category id list
youtube api video category id list
2 - Autos & Vehicles
1 - Film & Animation
10 - Music
15 - Pets & Animals
17 - Sports
18 - Short Movies
19 - Travel & Events
20 - Gaming
21 - Videoblogging
22 - People & Blogs
@triswan
triswan / enable-locale.sh
Last active October 3, 2017 07:31 — forked from hurie/setlocal.php
Set locale for Indonesian on all platform (Windows, Linux and others Nix server)credit for buana95 at yahoo dot com
# uncomment line id_ID.UTF8 UTF8 in file:
vim /etc/locale.gen
locale-gen
@triswan
triswan / deploy-laravel-2.sh
Last active September 8, 2020 08:07
Laravel Deployment
#!/bin/sh
#
## store the arguments given to the script
read oldrev newrev refname
## Where to store the log information about the updates
LOGFILE=./post-receive.log
# The deployed directory (the running site)
DEPLOYDIR=/home/swamedia/source/portal-elogistics
@triswan
triswan / 0_reuse_code.js
Created June 24, 2016 06:52
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console