Skip to content

Instantly share code, notes, and snippets.

View ChangJoo-Park's full-sized avatar
:octocat:
🌱

ChangJoo Park(박창주) ChangJoo-Park

:octocat:
🌱
View GitHub Profile
@ChangJoo-Park
ChangJoo-Park / logfineder.rb
Created April 29, 2014 00:22
로그에서 JAVA 부분만 추려서 파일로 쓰고 노트패드를 연다
if ARGV[0] != nil
originFile = ARGV[0]
contentsArray = IO.readlines(originFile)
currentTime = Time.now.strftime("%Y-%m-%d-%H-%M-%S")
targetFile = "#{ARGV[0]}_#{currentTime}.txt"
resultFile = File.open(targetFile, "w")
contentsArray.each do |line|
if (line =~ /JAVA/)
resultFile.write(line)
@ChangJoo-Park
ChangJoo-Park / index.html
Last active August 29, 2015 14:01
Angular JS - Examples
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<title>AngularJS</title>
</head>
<body>
<div>
<div ng-controller="MainCtrl">
<p ng-model="helloworld">{{ helloworld }}</p>
</div>
@ChangJoo-Park
ChangJoo-Park / gather.rb
Last active August 29, 2015 14:10
Gather only own tags using Ruby.
require 'date'
current_time = DateTime.now
current_time = current_time.strftime "%d/%m/%Y_%H_%M"
current_time = current_time.gsub(/[ :]/,'_')
current_time = current_time.gsub(/[ \/]/,'_')
somefile = File.open("result-#{current_time}.txt", "w")
# if you need change sourcefile name then below timestamp.txt to "yourfilename"
File.open("timestamp.txt") do |file|
file.each do |line|
<head>
<title>fabricjs</title>
<script src="fabric.js"></script>
</head>
<body>
<h1>Fabric</h1>
{{> main}}
</body>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="http://builds.handlebarsjs.com.s3.amazonaws.com/handlebars-v1.3.0.js"></script>
<script src="http://builds.emberjs.com/tags/v1.5.1/ember.js"></script>
@ChangJoo-Park
ChangJoo-Park / oop-1_rectangle.js
Last active August 29, 2015 14:19
Javascript The Right Way
// Point
var Point = (function() {
'use strict';
function Point(x, y) {
var x;
var y;
if (!(this instanceof Point)) {
return new Point(x, y);
}
@ChangJoo-Park
ChangJoo-Park / PlayState.hx
Created May 26, 2015 12:56
use FlxBullet
package;
import flixel.FlxG;
import flixel.FlxState;
import flixel.addons.weapon.FlxBullet;
import flixel.addons.weapon.FlxWeapon;
import flixel.util.FlxColor;
/**
* A FlxState which can be used for the actual gameplay.
@ChangJoo-Park
ChangJoo-Park / analyzer.rb
Last active December 10, 2015 03:28
oliver.txt파일을 읽어 파일의 내용을 분석한다. 전체 길이, 글자수(공백 유무), 단어, 문장, 문단의 수를 분석
# encoding: utf-8
lines=File.readlines("oliver.txt")
line_count=lines.size
text=lines.join
total_character=text.length
total_character_no_whitespace=text.gsub(/\s+/,'').length
word_count=text.split.length
paragraph_count=text.split(/\n\n/).length
sentence_count=text.split(/\.|\!|\?/).length
puts "전체 길이 : #{line_count}"
@ChangJoo-Park
ChangJoo-Park / stop_wods.rb
Last active December 10, 2015 03:28
불용어를 제외하고 보여줌
# encoding: utf-8
# Stop_words 2012-12-26
stop_words = %w{the a by on for of are with just but and to the my I has some in}
text=%q{Korea is officially the only divided nation in the world.}
words = text.scan(/\w+/)
key_words = words.select { |word| !stop_words.include?(word)}
puts "문장 중 키워드의 비율은 : #{((key_words.length.to_f/words.length.to_f)*100).to_i}%"
puts key_words.join(' ')
@ChangJoo-Park
ChangJoo-Park / current_user.rb
Created January 14, 2013 17:58
||= 를 사용하면 동일한 내용이 있는 경우 다시 쿼리를 하지 않음
def current_user
@current_user ||= User.find(session[:user_id])
end