Skip to content

Instantly share code, notes, and snippets.

View theeluwin's full-sized avatar
🎹
μŠ€μ½œλΌμ•„μ΄λŒκ΅μˆ˜λ²„νŠœλ²„

Jinseok Seol theeluwin

🎹
μŠ€μ½œλΌμ•„μ΄λŒκ΅μˆ˜λ²„νŠœλ²„
View GitHub Profile
@theeluwin
theeluwin / models.py
Created April 12, 2013 15:15
race condition problem
class Info(models.Model):
itemCount = models.PositiveIntegerField(default = 0)
class Item(models.Model):
name = models.CharField(max_length = 40)
@theeluwin
theeluwin / django restify
Created July 9, 2013 07:00
Making PUT and DELETE method reasonable for restful django.
def refine(request):
method = request.method
if method == 'PUT' or method == 'DELETE':
if hasattr(request, '_post'):
del request._post
del request._files
if([[[items1 valueForKey:@"paging"] valueForKey:@"limit"] intValue]==2)
{
[copyOfDirt setObject:[[items1 valueForKey:@"data"] valueForKey:@"id"][0] forKey:@"id"];
[copyOfDirt setObject:[[items1 valueForKey:@"data"] valueForKey:@"id"][1] forKey:@"id2"];
[copyOfDirt setObject:[[items1 valueForKey:@"paging"] valueForKey:@"limit"] forKey:@"count"];
[copyOfDirt writeToFile:plistPath atomically:YES];
}else{
[copyOfDirt setObject:[[items1 valueForKey:@"data"] valueForKey:@"id"][0] forKey:@"id"];
[copyOfDirt setObject:[[items1 valueForKey:@"paging"] valueForKey:@"limit"] forKey:@"count"];
[copyOfDirt writeToFile:plistPath atomically:YES];
@theeluwin
theeluwin / gist:7389439
Created November 9, 2013 20:12
Wrapping js with closure function for webassets filter
# define filter
def closure(_in, out, **kw):
out.write('(function(){' + _in.read() + '})()')
# example
bundle = Bundle('sample.js', filters = ('jsmin', closure))
@theeluwin
theeluwin / gist:8546603
Last active January 4, 2016 01:09
list comprehension odd lex
a = 1
b = [2, 3, 4, 5]
print a in [(a - 1) for a in b] # True
print [(a - 1) for a in b] # [1, 2, 3, 4]
print a # 5
curl 'http://m.comic.naver.com/comments/list_comment.nhn' -H 'Origin: http://m.comic.naver.com' -H 'Accept-Encoding: gzip,deflate,sdch' -H 'Accept-Language: ko-KR,ko;q=0.8,en-US;q=0.6,en;q=0.4' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Accept: */*' -H 'charset: utf-8' -H 'Referer: http://m.comic.naver.com/comment/listComment.nhn?titleId=119874&no=642&seq=640&week=sat&page=&category=webtoon&sortOption=best' -H 'Connection: keep-alive' --data 'ticket=comic1&object_id=119874_642&_ts=1391183769015&lkey=-BtXN2DL6yR8oLflFp7urFk0c_jBeLLYI42bb6WiFDNH02xg9qGu6g&category_id=default&page_size=15&page_no=1&sort=best' --compressed
var page = require('webpage').create();
var url = 'http://m.comic.naver.com/comment/listComment.nhn?titleId=119874&no=641&category=webtoon&sortOption=best';
page.open(url, function(s){
window.setTimeout(function(){
var fs = require('fs');
try {
fs.write('test.json', page.content, 'w');
} catch(e) {
console.log(e);
}
@theeluwin
theeluwin / helper.less
Created February 2, 2014 19:39
useful css classes.
@charset "utf-8";
.un-float {
float: none !important;
}
.un-padding {
padding: 0 !important;
}
function get_url_params() {
var search = window.location.search.substring(1);
if(search) {
return JSON.parse('{"' + decodeURI(search.replace(/"/g, '\\"')).replace(/&/g, '","').replace(/=/g,'":"') + '"}');
} else {
return {};
}
}
@theeluwin
theeluwin / my bower list
Created July 17, 2014 18:04
my bower list
β”œβ”€β”¬ angular-route#1.2.20 extraneous (1.2.21-build.322+sha.13289c0 available, latest is 1.3.0-build.2947+sha.eb2bab4)
β”‚ └── angular#1.2.20 (latest is 1.3.0-build.2947+sha.eb2bab4)
β”œβ”€β”¬ angular-sanitize#1.2.20 extraneous (1.2.21-build.322+sha.13289c0 available, latest is 1.3.0-build.2947+sha.eb2bab4)
β”‚ └── angular#1.2.20
β”œβ”€β”¬ bootstrap#3.2.0 extraneous
β”‚ └── jquery#2.1.1
β”œβ”€β”¬ bootstrap-select#1.5.4 extraneous
β”‚ └── jquery#2.1.1
β”œβ”€β”¬ imagesloaded#3.1.8 extraneous
β”‚ β”œβ”€β”€ eventEmitter#4.2.7