Skip to content

Instantly share code, notes, and snippets.

View toughrogrammer's full-sized avatar

Juhong Jung toughrogrammer

View GitHub Profile
@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()
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
using UnityEngine;
using System.IO;
public class Logger : MonoBehaviour
{
StreamWriter _writer;
public void Prepare()
{
#if UNITY_EDITOR
@toughrogrammer
toughrogrammer / CMakeLists.txt
Created October 24, 2014 09:13
cmakelists for opengl, glut on mac(practical)
cmake_minimum_required(VERSION 2.8.4)
project(helloworld)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
#########################################################
# Include Files
#########################################################
set(SOURCE_FILES main.cpp Cool.cpp)
add_executable(helloworld ${SOURCE_FILES})
@toughrogrammer
toughrogrammer / helloworld_.idea_.name
Created October 24, 2014 15:54
helloworld for opengl & glut with clion
helloworld
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