Skip to content

Instantly share code, notes, and snippets.

View toughrogrammer's full-sized avatar

Juhong Jung toughrogrammer

View GitHub Profile
function clone(object)
local lookup_table = {}
local function _copy(object)
if type(object) ~= "table" then
return object
elseif lookup_table[object] then
return lookup_table[object]
end
local new_table = {}
lookup_table[object] = new_table
package codelab.gdg.watchfacehack;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.support.wearable.watchface.CanvasWatchFaceService;
import android.view.SurfaceHolder;
public class AnalogWatchFaceService extends CanvasWatchFaceService {
@Override
#include <stdio.h>
#include <limits.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
#include <sys/time.h>
#define Random0to1 ((double) rand() / (RAND_MAX)) + 1
#define ITERATION 100000000
HCOPY 000000001033
DBUFFER000033BUFEND001033LENGTH00002D
RRDREC WRREC
T0000001D1720274B1000000320232900003320074B1000003F2FEC0320160F2016
T00001D0D0100030F200A4B1000003E2000
T00003003454F46
M00000405+RDREC
M00001105+WRREC
M00002405+WRREC
E000000
@toughrogrammer
toughrogrammer / gist:5330010
Last active December 15, 2015 21:59
시그마와 For문 비교입니다. 아래 소스코드의 sum 값은 시그마 i=0->4와 같습니다.
#include <stdio.h>
int main()
{
int sum = 0;
int i;
for( i=0; i<5; i++ )
{
sum = sum + i;
@toughrogrammer
toughrogrammer / mergesort
Last active December 18, 2015 03:49
Is it mergesort algorithm?
void init( int arr[], int size, int value )
{
int i;
for( i=0; i<size; i++ )
arr[i] = value;
}
void merge( int arr[], int leftstart, int leftend, int rightstart, int rightend )
{
int* tmp = new int[ rightend - leftstart + 1];
@toughrogrammer
toughrogrammer / gist:6155275
Last active December 20, 2015 15:38
Text length
/**
* Delegate method called before the text has been changed.
* @param textField The text field containing the text.
* @param range The range of characters to be replaced.
* @param string The replacement string.
* @return YES if the specified text range should be replaced; otherwise, NO to keep the old text.
*/
- (BOOL)textField:(UITextField *) textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
NSUInteger oldLength = [textField.text lengthOfBytesUsingEncoding:(0x80000000 + kCFStringEncodingDOSKorean)];
@toughrogrammer
toughrogrammer / usage-myanimation
Last active December 28, 2015 22:59
Usage of my cocos2d-x sprite animation class
// Create animatino class and run it
CCNode *anim = MyAnimation::create( "gamescene/star_sprite_animation.json" );
anim->PlayWithSequence( "eaten" );
@toughrogrammer
toughrogrammer / PanZoomLayer.cpp
Last active January 3, 2016 23:29
GrowingDever's PanZoomLayer :pIf it is useful to you, improve this and share please!
#include "PanZoomLayer.h"
PanZoomLayer::PanZoomLayer()
{
}
PanZoomLayer::~PanZoomLayer()
@app.route('/oauth/login', methods=['GET'])
def oauth_login():
form_data = {
'code': request.args['code'],
'redirect_uri': url_for('oauth_login', _external=True),
'grant_type': 'authorization_code',
'client_id': app.config.get('OAUTH_CLIENT_ID'),
'client_secret': app.config.get('OAUTH_CLIENT_SECRET'),
'scope': 'god'
}