Skip to content

Instantly share code, notes, and snippets.

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 July 8, 2014 16:12
Quick n dirty template to generate simple sql query: INSERT INTO TABLE ON DUPLICATE KEY UPDATE ...
/**
* @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 August 7, 2014 08:11
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
@bastman
bastman / ClientFactory
Created April 15, 2015 13:31
ClientFactory - Generics Example. Create Instances using Reflection
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 August 29, 2015 14:19
GenericMapExample - How to create a map function - using generics and lambdas
public class GenericMapExample {
private String value;
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
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 November 6, 2011 20:06
MySQLi simple dbclient standalone php
//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 November 7, 2011 11:46
simple jsonrpc server howto php
the request ...
================
{
"method":"foobar",
"params":["foo", "bar", "baz"]
}
@bastman
bastman / CallbackVO.as
Created November 16, 2011 19:09
jsonrpc client (as3)
package com.application.rpc
{
/**
* ...
* @author seb
*/
public dynamic class CallbackVO extends Object
{
@bastman
bastman / gist:1372905
Created November 17, 2011 10:56
as3 firelog - firebug logger
package com.basilicom.utils
{
import flash.external.ExternalInterface;
public class FireLog
{
public static function log(msg:String = null, data:* = null):void
{
try