Skip to content

Instantly share code, notes, and snippets.

View oanhnn's full-sized avatar
🇻🇳

Oanh Nguyen oanhnn

🇻🇳
View GitHub Profile
@leroy
leroy / Gulpfile.js
Created November 21, 2015 13:41
My Phaser gulp workplace
var gulp = require('gulp');
var gutil = require('gulp-util');
var source = require('vinyl-source-stream');
var buffer = require('gulp-buffer');
var babelify = require('babelify');
var browserify = require('browserify');
var browserSync = require('browser-sync');
var ROOT_PATH = "."
var PHASER_PATH = ROOT_PATH + '/node_modules/phaser/build/';
<?php
/* (c) Anton Medvedev <anton@elfet.ru>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Entity;
use Doctrine\ORM\Mapping as ORM;
@RudyLu
RudyLu / facebook_strophe.html
Created May 24, 2013 04:58
The sample code of using Strophe.js to connect to facebook chat
<html>
<head>
<script src="http://connect.facebook.net/en_US/all.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script src="strophe-102.js" type="text/javascript"></script>
<script src="facebook.js" type="text/javascript"></script>
<script>
var BOSH_SERVICE = 'http://island.csie.org:8273/xmpp-httpbind'
var connection = null;
@antonmedv
antonmedv / asciitree.js
Last active July 25, 2018 06:37
JavaScript function to print ASCII Tree
/**
* (c) 2014 Anton Medvedev
*
* SELECT_________________
* / \ \
* .___ FROM JOIN
* / \ | / \
* a city_name people address ON
* |
* =___________
@oanhnn
oanhnn / amazon-linux2-user-data.sh
Last active March 27, 2019 09:05
LEMP provider scripts
#!/bin/bash -ex
GITLABUSER=oanhnn
SSHUSER=oanhnn
addgroup dev
adduser --disabled-password --ingroup dev $SSHUSER
usermod -aG sudo $SSHUSER
mkdir -p /home/$SSHUSER/.ssh
@jeremyharris
jeremyharris / FixtureTestCase.php
Last active December 19, 2021 19:04
Full code for: http://someguyjeremy.com/blog/database-testing-with-phpunit Place fixtures in a `fixture` folder.
<?php
// we're loading the Database TestCase here
require 'PHPUnit' . DIRECTORY_SEPARATOR . 'Extensions' .
DIRECTORY_SEPARATOR . 'Database' . DIRECTORY_SEPARATOR .
'TestCase.php';
class FixtureTestCase extends PHPUnit_Extensions_Database_TestCase {
public $fixtures = array(
'posts',
@antonmedv
antonmedv / DotNotation.php
Last active August 11, 2022 13:47
Dot notation for access multidimensional arrays.
<?php
/**
* Dot notation for access multidimensional arrays.
*
* $dn = new DotNotation(['bar'=>['baz'=>['foo'=>true]]]);
*
* $value = $dn->get('bar.baz.foo'); // $value == true
*
* $dn->set('bar.baz.foo', false); // ['foo'=>false]
*
@josiahcarlson
josiahcarlson / sort_zset_cols.py
Last active August 23, 2022 08:15
A method to get sql-like multiple-column order by in Redis
'''
sort_zset_cols.py
Copyright 2013 Josiah Carlson
Released into the public domain.
'''
'''
Let's imagine that there are 3 restaurants with price, score, distance info
being:
@AndreasStokholm
AndreasStokholm / README.md
Created September 24, 2012 21:00 — forked from aronwoost/README.md
Auto-deploy with php and github on an Ubuntu Amazon EC2 box

##Auto-deploy with php and github on an Ubuntu Amazon EC2 box

Fork from other gist Build auto-deploy with php and git(hub) on an EC2 AMAZON AMI instance - Covers a basic Ubuntu isntall

When ever it says www-data below, it's the user Apache runs under. So if your apache user is called something else, change it to that.

##Install git

sudo aptitude install git-core
@joashp
joashp / PushNotifications.php
Last active July 28, 2023 12:33
Simple PHP script to send Android Push Notification, iOS Push Notification and Windows Phone 8 Push Notification
<?php
// Server file
class PushNotifications {
// (Android)API access key from Google API's Console.
private static $API_ACCESS_KEY = 'AIzaSyDG3fYAj1uW7VB-wejaMJyJXiO5JagAsYI';
// (iOS) Private key's passphrase.
private static $passphrase = 'joashp';
// (Windows Phone 8) The name of our push channel.
private static $channelName = "joashp";