This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fetch = (url) => { | |
return new Promise((resolve, reject) => { | |
https.get(url, (response) => { | |
const dataPromise = new Promise((resolve, reject) => { | |
const d = []; | |
let dlen = 0; | |
response.on('error', reject); | |
response.on('data', (data) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Webpack Base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// all falsy values do not display | |
function makeTemplate (html) { | |
return function (data) { | |
return html.replace(/\{\{\s*([^\s}]+?)\s*\}\}/g, function (match, key) { | |
return key.split('.').reduce(function (data, key) { | |
return data ? (data[key] || '') : ''; | |
}, data); | |
}); | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var age_group = age > 70 ? 'se' : | |
age > 60 ? 'si' : | |
age > 50 ? 'fi' : | |
age > 40 ? 'fo' : | |
age > 30 ? 'th' : | |
age > 20 ? 'tw' : | |
'un'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# default values | |
conf_file="$HOME/.gencert2" | |
key_file=key.pem | |
csr_file=csr.pem | |
cert_file=cert.pem | |
bits=1024 | |
get_vars(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function chainify(obj, that){ | |
if(typeof obj === 'object'){ | |
that = that || {__object: obj} | |
for(var i in obj){ | |
if(typeof obj[i] === 'function'){ | |
that[i] = function(){ | |
var ret = that.__object[i].apply(that.__object, arguments) | |
if(typeof ret === 'undefined') | |
return that | |
return ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
var http = require('http') | |
, path = require('path') | |
, url = require('url') | |
, fs = require('fs') | |
, base = path.resolve(process.argv[2] || '.') | |
, port = process.argv[3] || 8080 | |
http.createServer(function (req, res) { | |
var requrl = url.parse(req.url).pathname |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery.fn.newScroller = function(_options) { | |
if (typeof _options == "string") { | |
var args = Array.prototype.slice.call(arguments, 1) | |
return this.each(function() { | |
var $this = $(this) | |
data = $this.data("newScroller") | |
if (_options in data.functions) | |
data.functions[_options](args) | |
}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style type="text/css"> | |
.carousel-wrapper | |
{ | |
height: 420px; | |
margin-bottom: 20px; | |
background: #FFF; | |
border-radius: 8px; | |
-moz-border-radius: 8px; | |
-webkit-border-radius: 8px; | |
overflow: hidden; |