Skip to content

Instantly share code, notes, and snippets.

View ktmud's full-sized avatar
🥌
Peace and Love~

Jesse Yang ktmud

🥌
Peace and Love~
View GitHub Profile
@ktmud
ktmud / gist:1825369
Created February 14, 2012 09:41
responsive test jade template
!!!
html
head
title Responsive Test
<style>body { margin: 20px; font-family: sans-serif; overflow-x: scroll; }.wrapper { width: 6000px; }.frame { float: left; }h2 { margin: 0 0 5px 0; }iframe { margin: 0 20px 20px 0; border: 1px solid #666; }</style>
body
- sizes = [ [240, 320, 'mobile'], [320, 480, 'mobile'], [480, 640, 'small tablet'], [768, 1024, 'tablet - portrait'], [1024, 768, 'tablet - landscape'], [1200, 800, 'desktop'], ];
.wrapper
each item in sizes
.frame
@ktmud
ktmud / seajs-bigpipe.js
Created February 14, 2012 10:56
BigPipe with SeaJS
// this script should be inline
(function(win, doc, seajs) {
var $ = function(id) {
if (typeof id == 'string') return document.getElementById(id);
return id;
};
$.uuid = 0;
/**
* @param {array} funs 需要执行的函数,一个文本数组.
@ktmud
ktmud / app.danamicHelpers.js
Created February 18, 2012 17:20
inline compressed static files for express
var conf = central.conf;
var reg_val = /#{([^}]+)}/g;
module.exports = function(app) {
app.helpers({
DEBUG: conf.debug
});
app.dynamicHelpers({
// inline static
istatic: function(req, res) {
@ktmud
ktmud / value-placeholder.js
Created July 31, 2012 08:46
input placeholder using elem.value
(function() {
var canNative = (function() {
var elem = document.createElement('input');
return 'placeholder' in elem;
})();
$.fn.placeholder = function(text, cls, noNative) {
var self = this;
text = text || '';
cls = cls || 'blur';
if (!noNative && canNative) {
@ktmud
ktmud / dabblet.css
Created August 2, 2012 07:38
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
@ktmud
ktmud / boot.sh
Created November 12, 2012 11:59
Git部署多个NodeJS应用
#... 加入你的启动脚本中
su www -c "/srv/nodejs/nogo.sh weixin halt reboot"
su www -c "/srv/nodejs/nogo.sh loudlaw halt reboot"
@ktmud
ktmud / pastebin.sh
Last active June 26, 2022 01:34
Pastebin Bash Script.
#!/bin/bash
# Paste at Pastebin.com using command line (browsers are slow, right?)
# coder : Anil Dewani
# date : Novemeber 7, 2010
#help function
howto()
{
echo "\
Pastebin.com Bash Script \
@ktmud
ktmud / microdata.py
Last active December 10, 2015 04:28 — forked from bellbind/microdata.py
parse html5 microdata to dict
# -*- encoding:utf-8
"""
(c) https://gist.github.com/577116
HTML5 microdata parser for python 2.x/3.x
- it requires lxml
- microdata specification: http://dev.w3.org/html5/md/
"""
try: from urllib.parse import urljoin
@ktmud
ktmud / formatting
Last active December 19, 2015 09:28
log formatting
#!/bin/bash
logfiles="/mfs/log/scribe/xxxxx/*/*_current"
TAB="$(printf '\t')"
for f in $logfiles; do
while IFS=$TAB; read -r SITE USER_ID CONTENT EXTRA UA COOKIE; do
echo "[$SITE] $USER_ID"
echo "-----------------"
echo -e "$CONTENT"
<?
/*by qiuchi @ 2010-11-03 */
$uri = str_replace('index.php', '', $_SERVER["REQUEST_URI"]);
//echo $uri . "\n\n";
if ( !strpos($uri, '??') ) {
include_once 'fetch.php';
exit;
}