Skip to content

Instantly share code, notes, and snippets.

@need4spd
need4spd / client.js
Created November 27, 2012 09:13
nodejs 설명
$(window).load(function() {
var another =
io.connect('http://localhost:9000/deployStatusSocket');
another.on('deploy status', function(data, callback) {
callback("OK!");
changeStatusMessage(data);
});
});
@need4spd
need4spd / mysql.js
Created November 27, 2012 09:16
node js sample
var _mysql = require('mysql');
var host = '127.0.0.1';
var port = '3306';
var mysql_user = 'scott';
var mysql_pass = 'tiger';
var database = 'database';
var mysql = _mysql.createClient({
host: host,
port: port,
@need4spd
need4spd / keysSortedByValueUsingSelector.m
Created November 27, 2012 09:20
keysSortedByValueUsingSelector 설명
NSDictionary *ndic = [[NSDictionary alloc] initWithObjectsAndKeys:@"value1", @"key1", @"value2", @"key2", nil];
NSLog(@"ndic %@", [ndic objectForKey:@"key1"]);
for(NSString *key in ndic) {
NSLog(@"%@", key);
}
NSArray *keySorted = [ndic keysSortedByValueUsingSelector:@selector(compare:)];
@need4spd
need4spd / NSInvocation.m
Created November 27, 2012 09:25
NaviController 설명
#import <foundation/foundation.h>
int main(int argc, const char * argv[])
{
@autoreleasepool {
NSString *prose = @"Do nine men interpret?";
NSMethodSignature *signature;
NSInvocation *invocation;
NSString *count;
@need4spd
need4spd / semaphore.java
Created November 27, 2012 09:33
semaphore 설명
public class BoundedExecutor {
private final Executor exec;
private final Semaphore semaphore;
private Log logger = LogFactory.getLog(BoundedExecutor.class);
public BoundedExecutor(Executor exec, Semaphore semaphore) {
this.exec = exec;
this.semaphore = semaphore;
}
@need4spd
need4spd / 54.py
Created November 27, 2012 09:36
오일러프로젝트 문제풀이
def is_royal_flush(nums, marks):
number="".join(str(n) for n in nums)
mark_set = set(marks)
if number == "1011121314" and len(mark_set) == 1:
return (True, nums[4])
else:
return (False, nums[4])
def is_st_flush(nums, marks):
@need4spd
need4spd / 53.pl
Created November 28, 2012 00:03
오일러프로젝트 문제풀이#2
sub fact {
my ($n) = @_;
if ($n == 1) {
return 1
}
my $result = 1;
foreach my $d ((1..$n)) {
$result = $result * $d;
@need4spd
need4spd / 52.pl
Created November 28, 2012 00:25
오일러 52
use strict;
use warnings;
sub is_permutations {
my ($a, $b) = @_;
#print "$a, $b \n";
my @s_a = split //, $a;
@s_a = sort @s_a;
my $a_str = join "", @s_a;
@need4spd
need4spd / 51.pl
Created November 28, 2012 00:28
오일러 51
use strict;
use warnings;
sub is_prime_number {
my($num) = @_;
my $t=2;
while ($t <= $num) {
my $rest = $num % $t;
@need4spd
need4spd / 50.pl
Created November 28, 2012 00:33
오일러 50
use strict;
use warnings;
sub is_prime_number {
my($num) = @_;
my $t=2;
while ($t <= $num) {
my $rest = $num % $t;