Skip to content

Instantly share code, notes, and snippets.

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

Jinseok Seol theeluwin

🎹
μŠ€μ½œλΌμ•„μ΄λŒκ΅μˆ˜λ²„νŠœλ²„
View GitHub Profile
def price(value):
parts = str(value).split('.')
parts[0] = re.sub('\B(?=(\d{3})+(?!\d))', ',', parts[0])
return '.'.join(parts)
@theeluwin
theeluwin / dead angular
Created November 9, 2014 15:45
rock is dead.
app.config(function($provide){
$provide.decorator("$browser", ["$delegate", function($delegate){
$delegate.onUrlChange = function(){};
$delegate.url = function(){return "";};
return $delegate;
}]);
});
@theeluwin
theeluwin / filters.js
Created July 28, 2014 08:39
useful angular filters
// converts link in text into anchor
app.filter("link_finder", function(){
return function(input){
return input? input.replace(/(\bhttps?:\/\/[^\s<>"`{}|\^\[\]\\]+)/g, "<a href='$1' target='new'>$1</a>") : "";
};
});
// escape '<' and '>'
app.filter("escape_html", function(){
return function(input){
β”œβ”€β”¬ angular-route#1.2.20 extraneous (1.2.21-build.341+sha.5d11e02 available, latest is 1.3.0-build.2977+sha.11f5aee)
β”‚ └── angular#1.2.20 (latest is 1.3.0-build.2977+sha.11f5aee)
β”œβ”€β”¬ angular-sanitize#1.2.20 extraneous (1.2.21-build.341+sha.5d11e02 available, latest is 1.3.0-build.2977+sha.11f5aee)
β”‚ └── angular#1.2.20
β”œβ”€β”€ angular-seo#e801dc02ed extraneous
β”œβ”€β”€ angular-ui-bootstrap#0.11.0 extraneous
β”œβ”€β”¬ angular-ui-router#0.2.10 extraneous
β”‚ └── angular#1.2.20 (1.3.0-build.2977+sha.11f5aee available)
β”œβ”€β”€ bootstrap#3.2.0 extraneous
β”œβ”€β”¬ bootstrap-datepicker#1.3.0 extraneous
@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
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 / helper.less
Created February 2, 2014 19:39
useful css classes.
@charset "utf-8";
.un-float {
float: none !important;
}
.un-padding {
padding: 0 !important;
}
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);
}
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
@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