Skip to content

Instantly share code, notes, and snippets.

View korrio's full-sized avatar
👽

kOrriO korrio

👽
  • Hal Finney Co.,Ltd.
  • mempool
  • X @korrio
View GitHub Profile
@korrio
korrio / gist:34c0e92db353bace9a94
Created November 12, 2014 00:39
POST Method (ต.ย. วิธี parse ค่า json ที่ส่งมาจาก android)
app.post('/api/products', function (req, res){
var product;
console.log("POST: ");
console.log(req.body);
product = new ProductModel({
title: req.body.title,
description: req.body.description,
style: req.body.style,
});
product.save(function (err) {
@korrio
korrio / gist:cec6dff42a926a9e4da8
Created November 12, 2014 03:18
onActivityResult
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == Activity.RESULT_OK) {
File f = new File(Environment.getExternalStorageDirectory()
.toString());
for (File temp : f.listFiles()) {
if (temp.getName().equals("temp.jpg")) {
f = temp;
@korrio
korrio / gist:8dd031ea4332c579a203
Created December 17, 2014 01:24
Check update and update
package com.ame.armymax;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.Activity;
import android.app.ProgressDialog;
@korrio
korrio / gist:ee448cabed895373b2b3
Created December 17, 2014 01:32
UpdateService
package com.ame.armymax.service;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import android.app.ProgressDialog;
import android.content.Context;
@korrio
korrio / gist:9f58d889cd488648c9dc
Created May 5, 2015 10:08
SK_getVideosWithPPV
function SK_getVideosWithPPV($query,$numL = 0,$numM = 8,$sort='N'){
global $dbConnect;
$sql = '';
if(!empty($query)){
$query = SK_secureEncode($query);
$sql = "AND b.youtube_title LIKE '%".$query."%'";
}else{
$sql = "";
}
//A
<br />
<b>Warning</b>: pg_query() [<a href='function.pg-query'>function.pg-query</a>]: Query failed: ERROR: could not open file &quot;/home/asset/public_html/motorway_dev/admin/upload/143098701295.csv&quot; for reading: No such file or directory in <b>/home/asset/public_html/motorway_dev/_db.php</b> on line <b>38</b><br />
<br />
<b>Warning</b>: rename(/home/asset/public_html/motorway_dev/admin/upload/143098701295.csv,/home/asset/public_html/motorway_dev/admin/upload/history/143098701295.csv) [<a href='function.rename'>function.rename</a>]: No such file or directory in <b>/home/asset/public_html/motorway_dev/admin/run_db/run.php</b> on line <b>152</b><br />
{"status":"S01"}
@korrio
korrio / eloquent.md
Last active August 29, 2015 14:22 — forked from msurguy/eloquent.md

Conventions:

Defining Eloquent model (will assume that DB table named is set as plural of class name and primary key named "id"):

class Shop extends Eloquent {}

Using custom table name

protected $table = 'my_shops';

@korrio
korrio / gist:52b894d0d741bd2d45f4
Created May 30, 2015 14:08
ssh key chat server
MIIJJwIBAAKCAgEAtrFKqrK8uvThnjbZG4f89Umm/e2RfCq6bFmaYFXu3zpVMdVY
HEek5AitBVdjqCtVTjwvn24oPz+9rpxm+jmDxyPXKXWeCdFstrrRLKBzp6kPAc9w
dWECYIqCYoMecdGU+kNjhLEvEn8xn4F2VB66xn0oKuaik6zXy4/Tr4kKOX90YUt4
utVpjJ10TZMdLtPfuqCuQe2fJT0O4WAkudh4uQXdtJ+BPqtspInF9dtIAfNbupTd
a+z5JEimHBqt+QORABcHdjq6Q32O44eZRin/NZBwUQ56RHIZQkq/T8f2cCB1AQAI
HTq6iqTrugAlZLV9n4syZiS1wfn6b2aEdkeJ8CK3LG0BlIpSJqv9EdqYFuS+0lo/
fccoTE4485D87Ig1Tj/hZO666EGuekhwxl1nK6QV5q14l+S8RhAoR9GmWlZNVk37
vB0tl0ZzTvOpFJlgKAcsgGqxGFqtbHzhevOXUg3LRl6krfieWiB0BTJtvoCA8+6U
gOrxF8lByuusFT51odHBe4UjfRTLQNuPWzci03+/n/3UQlN5Wn59sdqIK5UPbRH5
GJUORe/zAX9MyS/5vNsN5+8GXDaYbjYHvEAWHXyK+VwY0TVnEzty75u05e3I2sC0
@korrio
korrio / gist:c40bda45b290e5fb047c
Created June 9, 2015 17:10
getLastChatHistory
function getLastChatHistory($user_id, $friend_id, $message_size, $message_page, $conversation_id,$sort)
{
//DB Connection
$db2 = dbConnect();
$output = array();
//Header
$user_info = getUserDetails($user_id);
$friend_info = getUserDetails($friend_id);
'use strict';
//Dep
var request = require('request');
push("aaa",400,3,6,"",null);
// Chat Notifcation
function push( message, messageType, senderId, receiverId, data, all ) {
var unreadCount = 0;