Skip to content

Instantly share code, notes, and snippets.

View CrowdParkRpc2.js
CrowdparkRpc = {
invokeRpc: function (httpMethod, url, method, params, baseParams, callback) {
var method = '' + method;
if (!params) {
var params = [];
}
var rpc = {
method: method,
params: params
@bastman
bastman / createSqlInsertIntoTableOnDuplicateKeyUpdate
Created Jul 8, 2014
Quick n dirty template to generate simple sql query: INSERT INTO TABLE ON DUPLICATE KEY UPDATE ...
View createSqlInsertIntoTableOnDuplicateKeyUpdate
/**
* @param string $table
* @param array $rowInsert
* @param array $rowUpdate
* @return array
*/
function createSqlInsertIntoTableOnDuplicateKeyUpdate($table, $rowInsert, $rowUpdate)
{
$insertColumnTokens = array();
$insertValueTokens = array();
@bastman
bastman / 0_reuse_code.js
Created Aug 7, 2014
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@bastman
bastman / ClientFactory
Created Apr 15, 2015
ClientFactory - Generics Example. Create Instances using Reflection
View ClientFactory
public class ClientFactory {
public static <T extends Client> T createClient(Class<T> clientClass, String host, Integer port)
{
try {
Constructor<T> constructor = clientClass.getConstructor(
String.class, Integer.class
);
T client = constructor.newInstance(
@bastman
bastman / GenericMapExample.java
Last active Aug 29, 2015
GenericMapExample - How to create a map function - using generics and lambdas
View GenericMapExample.java
public class GenericMapExample {
private String value;
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
View Rakefile
task :default => 'tasklist'
desc "List & Describe Tasks"
task :tasklist do
sh "rake -P"
sh "rake -T"
end
namespace :composer do
composer_phar="./composer.phar"
@bastman
bastman / MySQLIDB Example
Created Nov 6, 2011
MySQLi simple dbclient standalone php
View MySQLIDB Example
//Example
//=======
ini_set("display_errors", true);
error_reporting(E_ALL|E_STRICT & ~E_NOTICE);
set_error_handler(function($errno, $errstr, $errfile, $errline){
throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
});
$db = MySQLiDB::getInstance();
@bastman
bastman / gist:1344759
Created Nov 7, 2011
simple jsonrpc server howto php
View gist:1344759
the request ...
================
{
"method":"foobar",
"params":["foo", "bar", "baz"]
}
@bastman
bastman / CallbackVO.as
Created Nov 16, 2011
jsonrpc client (as3)
View CallbackVO.as
package com.application.rpc
{
/**
* ...
* @author seb
*/
public dynamic class CallbackVO extends Object
{
@bastman
bastman / gist:1372905
Created Nov 17, 2011
as3 firelog - firebug logger
View gist:1372905
package com.basilicom.utils
{
import flash.external.ExternalInterface;
public class FireLog
{
public static function log(msg:String = null, data:* = null):void
{
try