Skip to content

Instantly share code, notes, and snippets.

@mcfog
mcfog / jade-coco.co
Created December 24, 2011 13:48
coco filter for Jade
require(\jade)filters.coco = (str)->
str = str.replace /\\n/g, '\n'
js = require(\coco)compile(str)replace(/\n/g, '\\n')
"<script type='text/javascript'>#js</script>"
@mcfog
mcfog / Cokefile
Created December 25, 2011 08:24
coco cokefile(copy . to build and compiling all .co
{spawn} = require \child_process
SHELL = if(\win32 == process.platform) then "cmd /c " else "sh -c "
output = (error, stdout, stderr)->
if (error)
console.error stderr.trim!
else
console.log stdout.trim!
void
@mcfog
mcfog / contenteval.co
Created December 31, 2011 04:36
coco - contentEval
contentEval = (source, doc=document)->
source = '(' + source + ')();' if \function == typeof source
script = doc.createElement \script
script.setAttribute \type, "application/javascript"
script.textContent = source
doc.body.appendChild script
doc.body.removeChild script
@mcfog
mcfog / qq.co
Created January 18, 2012 07:37
everyauth module for qq
everyauth = require 'everyauth'
oauthModule = require 'everyauth/lib/modules/oauth2'
url = require 'url'
rest = require 'everyauth/lib/restler'
qq = module.exports = oauthModule.submodule('qq')
.configurable do
scope: 'URL identifying the Tencent QQ service to be accessed. See the documentation for the API you\'d like to use for what scope to specify. To specify more than one scope, list each one separated with a space.'
.oauthHost 'https://graph.qq.com'

*** How to use

  1. replace the tortoiseGit install path in tortoiseGit_win7_menu.reg with yours and import it into registry
  2. open regedit, edit HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{5c4f28b5-f869-4e84-8e60-f11db97c5cc7}\TasksNoItemsSelected & HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{5c4f28b5-f869-4e84-8e60-f11db97c5cc7}\TasksItemsSelected
    use names like "mcfog.git.commit", semicon-seperated, example:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{5c4f28b5-f869-4e84-8e60-f11db97c5cc7}\TasksItemsSelected]
@="mcfog.git.menu.svn;mcfog.git.log;mcfog.git.diff;mcfog.git.sync;mcfog.git.menu.branch"
@mcfog
mcfog / preview.co
Last active December 17, 2015 18:39
hexo-preview
(args) <- hexo.extend.console.register 'preview' 'watch change and run server'
hexo.extend.console.list!generate {w:true}
hexo.extend.console.list!server args
@mcfog
mcfog / README.md
Created June 12, 2013 13:25
`hexo new` 后自动打开新建的文件

用法:将open.js放入scripts目录下,然后在你的hexo目录中打开cmd,执行

npm i open

即可

@mcfog
mcfog / grid.styl
Created June 13, 2013 21:49
a semantic grid mixin for Stylus, better with PR <https://github.com/LearnBoost/stylus/pull/1048>
grid-ctn(containerwidth, col, padwidth = grid-devide(containerwidth, col * 8))
$grid_width grid-devide(containerwidth, col)
$grid_col col
$grid_padding grid-devide(padwidth, 2)
width containerwidth
position relative
clearfix()
grid-block(colspan)
<- define <[jquery]>
let @ = Deferred = {}
@when = $~when
@defer = ->
dfr = $.Deferred!
{
@mcfog
mcfog / .jshintrc
Created April 27, 2014 02:43
my jshint config for nodejs
{
"curly": true,
"eqeqeq": true,
"immed": true,
"latedef": "nofunc",
"noarg": true,
"undef": true,
"boss": true,
"devel": true,
"node": true