Skip to content

Instantly share code, notes, and snippets.

View LabiKyo's full-sized avatar
🎯
Focusing

Labi Kyo LabiKyo

🎯
Focusing
View GitHub Profile
@LabiKyo
LabiKyo / trim-string
Last active October 20, 2015 07:16
trim string
import readline from 'readline';
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
const REGEX = /(\d)(\d+)/g;
let results = [];
rl.on('line', (line) => {
@LabiKyo
LabiKyo / KTXP-helper.js
Last active December 14, 2015 09:18
Script for get a list of thunder download links on bt.ktxp.com's search page. Separated by EOL.
body = $('a.quick-down')
.map(function (index, elem) {
return 'http://bt.ktxp.com' + $(elem).attr('href');
})
.toArray()
.join('<br>');
window.open('data:text/html,<body contenteditable="true">' + body + '</body>');
@LabiKyo
LabiKyo / YYeTs-helper.js
Last active December 12, 2015 00:28
Script for get a list of thunder download links on YYeTs.com's download page. Separated by EOL.
body = $('#tabs .box_1 ul:visible input:checked')
.parent()
.find('a:contains(迅)')
.map(function (index, elem) {
return $(elem).attr('bbnxuxof');
})
.toArray()
.join('<br>');
window.open('data:text/html,<body contenteditable="true">' + body + '</body>')
@LabiKyo
LabiKyo / less2stylus.coffee
Created October 7, 2012 14:38 — forked from lancejpollard/less2stylus.coffee
Convert Less to Stylus for general purpose
less2stylus = (string) ->
string = string
.replace(/^(\ *)(.+)\ +\{\ *\n?\ */mg, "$1$2\n$1 ") # remove opening brackets
.replace(/^(\ *)([^\ \n]+)\ +\{\ *\n?\ */mg, "$1$2\n$1 ") # remove opening brackets
.replace(/\ *\{\ *\n*/g, "\n") # remove opening brackets again (some random cases I'm too lazy to think through)
.replace(/\ *\}\ *\n*/g, "\n") # remove closing brackets
.replace(/\;\ *?$/gm, "") # remove semicolons
.replace(/@(\w+):(\ *)\ /g, (_, $1, $2) -> # replace @variable: with $variable =
"$#{$1}#{$2} = "
)