Skip to content

Instantly share code, notes, and snippets.

Vector2D = {}
function Vector2D:new(x, y)
local object = { x = x, y = y }
setmetatable(object, { __index = Vector2D })
return object
end
function Vector2D:copy()
return Vector2D:new(self.x, self.y)
@poisa
poisa / bmf.lua
Created July 23, 2014 01:13 — forked from tomekc/bmf.lua
module( ..., package.seeall )
-- AngelCode bitmap font support
-- Updated for Graphics 2.0
-- Download sprite module from https://github.com/coronalabs/framework-sprite-legacy/raw/master/sprite.lua
local sprite = require( "sprite" )
-- Specify an Angelcode format bitmap font definition file (".FNT")
-- The spritesheet(s) that this file references need to be located in the resource directory.
angular.module('appName').factory('RestService', ['Restangular', '$q', function(Restangular, $q){
var service;
return {
setService: function($serviceName){
service = Restangular.all($serviceName);
},
create: function($data){
var serviceDeferred = $q.defer();
require 'vendor/autoload.php';
use Aws\Sns\Validator\SnsValidator;
$incomingMessage = json_decode($HTTP_RAW_POST_DATA);
try {
// Case 1:
// Full auto pilot mode (this detects the strategy based on the 'Type' property of the incoming message
@poisa
poisa / gist:6724548
Last active December 24, 2015 01:29
Generic method call using trigger()
<?php
public function findMemberById($id)
{
$params = $this->getEventManager()->prepareArgs(compact(func_get_args()));
$result = $this->getEventManager()->trigger(__FUNCTION__ . '.pre', $this, $params, function ($listenerOutput) {
return ($listenerOutput != null);
});
extract((array)$params);
<?php
abstract class AbstractCello
{
/**
* @var EventManager
*/
protected $em;
protected function triggerPre($methodName, $params)
public function getConfigFromDb()
{
if (!is_null($this->configInDb)) {
return $this->configInDb;
}
$sql = new Sql($this->getSlaveDbAdapter());
$select = $sql->select()
->from('languages');
@poisa
poisa / supervisord.sh
Created March 31, 2016 02:58 — forked from mhayes/supervisord.sh
init.d for supervisord for Amazon Linux AMI
#!/bin/sh
# Amazon Linux AMI startup script for a supervisor instance
#
# chkconfig: 2345 80 20
# description: Autostarts supervisord.
# Source function library.
. /etc/rc.d/init.d/functions
supervisorctl="/usr/bin/supervisorctl"
@poisa
poisa / gist:3616c8f024b8c9b0500ac1f9bd0268ba
Created October 8, 2017 18:53 — forked from sgergely/gist:3793166
Midnight Commander Keyboard Shortcuts for Mac OSX
----- Esc -----
Quick change directory: Esc + c
Quick change directory history: Esc + c and then Esc + h
Quick change directory previous entry: Esc + c and then Esc + p
Command line history: Esc + h
Command line previous command: Esc + p
View change: Esc + t (each time you do this shortcut a new directory view will appear)
Print current working directory in command line: Esc + a
Switch between background command line and MC: Ctrl + o
Search/Go to directory in active panel: Esc + s / Ctrl + s then start typing directory name
@poisa
poisa / mongodb.md
Created June 27, 2018 02:55
#mongodb cheat sheet

MongoDB cheat sheet

Overview

Overview

MongoDB is a document database that provides high performance, high availability, and easy scalability.

  • Document Database