Skip to content

Instantly share code, notes, and snippets.

arief nur andono goldalworming

Block or report user

Report or block goldalworming

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@goldalworming
goldalworming / async loop
Last active Aug 29, 2015
loop in node.js should use recursive or async (node-async) but if you use total.js framework, async feature already exist and this is the comparation of using non-node.js programmer's loop to better approach
View async loop
rc.zrange(['cust', '0', '-1'], function(err, data) {
if (err) {
rc.quit();
self.throw500(err);
return;
}
var length = data.length;
View gist:a1dc3701938c7183f848
ogr2ogr ProvinsiSimply.shp Provinsi.shp -simplify 0.001
ogr2ogr -f geoJSON provinsisimplyoutput.json ProvinsiSimply.shp
@goldalworming
goldalworming / getangularjspost
Created Jun 25, 2014
get angular post in codeigniter / php
View getangularjspost
public function post(){
$arraydata = json_decode(file_get_contents('php://input'));
}
@goldalworming
goldalworming / inserttooracle.php
Created Jun 26, 2014
insert date to oracle php
View inserttooracle.php
$objarray['tgl'] = date("Y-m-d",strtotime($arraydata->ACT_TGLENTRY));
$sql="insert into mart_dws_activity (ACT_GPART,ACT_BU_NAME,ACT_ID_ACT,ACT_JNSACT,ACT_PICTELKOM,ACT_TGLENTRY,ACT_RESULT,ACT_TLPRMH,ACT_PICCUST) values ('$gpart', '$bu_name', '$id', '$jns', '$pictelkom', to_date('$tgl','yyyy-mm-dd'), '$result', '$telprmh', '$piccust')";
@goldalworming
goldalworming / detectmobile.js
Created Jul 2, 2014
detect mobile in total.js
View detectmobile.js
var regMobile = /iPad|iPhone|iPod|Android/g;
if (regMobile.test(controller.req.headers['user-agent']))
console.log('Is mobile device');
@goldalworming
goldalworming / totaljs-glupsauth.js
Last active Aug 29, 2015
straightforward glus auth without any library
View totaljs-glupsauth.js
framework.route('/login/gplus/', process_gplus,{timeout: 60000});
function process_gplus() {
var self = this;
var auth = self.module('authorization');
objgplus = {
client_id:'[yourclientid]',
client_secret:'[yourclientsecret]'
};
View timeout-watch-angular.js
var timeoutPromise;
var delayInMs = 2000;
$scope.$watch("query", function () {
$timeout.cancel(timeoutPromise); //does nothing, if timeout alrdy done
timeoutPromise = $timeout(function(){ //Set timeout
$scope.loading = true;
returnFactory.query($scope.query).then(function (returns) {
$scope.returns = returns;
$scope.loading = false;
});
@goldalworming
goldalworming / stringtojscode
Created Aug 8, 2014
javascript code from string
View stringtojscode
var a = [1, 2, 3, 45]
var fn = new Function('vars', 'if (vars.length==5){return "benar";}else{return "salah"}');
fn(a);
View nodejsredis.js
var http = require("http"), server,
redis_client = require("redis").createClient();
server = http.createServer(function (request, response) {
response.writeHead(200, {
"Content-Type": "text/plain"
});
redis_client.get('id:'+'value', function(err, idclient) {
@goldalworming
goldalworming / complete_mysql_multiplequery.js
Last active Aug 29, 2015
query yang parameternya dari text
View complete_mysql_multiplequery.js
exports.install = function(framework) {
framework.route('/querymysql/', multiplequery,['post','json']);
};
function multiplequery(){
var self = this;
var auth = self.module('authorization');
self.post.newkode = function(){
return utils.GUID([9]);
}
You can’t perform that action at this time.