Skip to content

Instantly share code, notes, and snippets.

View appkr's full-sized avatar
🎯
Focusing

appkr appkr

🎯
Focusing
View GitHub Profile
@appkr
appkr / sqlite
Created June 17, 2016 06:45
SQLite
$ sqlite3 path-to-database-file
sqlite> .tables # list tables
sqlite> .headers ON
sqlite> .mode columns
sqlite> PRAGMA table_info(table_name); # table schema
sqlite> SELECT type, name, tbl_name FROM sqlite_master WHERE type='index';
# list index
<?php
namespace Test\Http\Controllers;
trait AuthHelper
{
/**
* @var array
*/
protected $userPayload = [
<?php
namespace Test;
class SeleniumTestCase extends \PHPUnit_Extensions_Selenium2TestCase
{
/**
* The base URL to use while testing the application.
*
* @var string
@appkr
appkr / gist:7d85ab9c9ceb6c675f1c88a8c3f5f73c
Created August 26, 2016 07:01 — forked from egoing/gist:1f14bbe0cba467ccacfb
페이스북 자동 가입
auto_register = new Object();
auto_register.add_member = function(member_id, group_id, ignore, callback) {
x = new XMLHttpRequest();
x.onreadystatechange = function() {
if (x.readyState == 4) {
if (x.status == 200) {
if (callback)
callback(member_id, group_id);
console.log('success', member_id);
} else
@appkr
appkr / SnsBroadcaster.php
Created October 22, 2016 07:43 — forked from jeskew/SnsBroadcaster.php
Laravel broadcasting with SNS
<?php
use Aws\Sns\SnsClient;
use Illuminate\Contracts\Broadcasting\Broadcaster;
class SnsBroadcaster implements Broadcaster
{
/** @var SnsClient */
private $sns;
/** @var array */
@appkr
appkr / web.php
Last active October 23, 2016 06:47
AWS SNS in Laravel
// Install SDK
// https://github.com/aws/aws-sdk-php-laravel
Route::post('sns', function(\Illuminate\Http\Request $request) {
$message = json_decode($request->getContent())->Message;
Log::info([$request->header('content-type'), $message]);
// do some job.
return response('', 204);
@appkr
appkr / web.php
Created October 24, 2016 15:06
Queue demo
# $ touch database/database.sqlite
# $ php artisan queue:table
# $ php artisan queue:failed-table
# $ php artisan migrate
# $ php artisan make:job DemoJob
# $ php artisan tinker
# >>> factory(App\User::class)->create();
<?php
node {
// https://registry.hub.docker.com/_/maven/
def maven32 = docker.image('maven:3.2-jdk-7-onbuild');
stage 'Mirror'
// First make sure the slave has this image.
// (If you could set your registry below to mirror Docker Hub,
// this would be unnecessary as maven32.inside would pull the image.)
maven32.pull()
// We are pushing to a private secure docker registry in this demo.
@appkr
appkr / lumen_ide_helper.php
Created February 9, 2017 02:41 — forked from barryvdh/lumen_ide_helper.php
Lumen IDE Helper
<?php
/**
* A helper file for Laravel 5, to provide autocomplete information to your IDE
* Generated for Laravel Lumen (5.1.1) (Laravel Components 5.1.*) on 2015-08-18.
*
* @author Barry vd. Heuvel <[email protected]>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
namespace {
@appkr
appkr / Twig.php
Created March 11, 2017 08:04
Twig.php
<?php
/**
* Slim - a micro PHP 5 framework
*
* @author Josh Lockhart
* @author Andrew Smith
* @link http://www.slimframework.com
* @copyright 2013 Josh Lockhart
* @version 0.1.0
* @package SlimViews