Skip to content

Instantly share code, notes, and snippets.

# -*- coding: utf-8 -*-
description 'exec git push after save page'
Page.hook :after_commit do
Olelo.logger.info "push git history after save page"
git_path = Config[:repository][:git][:path]
response = `git --git-dir=#{git_path} --bare push origin master 2>&1`
if $?.success?
Olelo.logger.info "git history push success"
else
#!/usr/bin/env bash
# GistID: 9499613
# Example Makefile:
# npm :
# @echo "Check npm package update..."
# @CHECK_FILE=package.json STATE_FOLDER=node_modules bash scripts/update_manager.sh check; \
# if [ $$? -eq 1 ]; then \
# npm install \
# && npm update \
through = require 'through2'
cssWhitespaceCompiler = require 'css-whitespace'
rework = require 'rework'
rework_calc = require 'rework-calc'
rework_vars = require 'rework-vars'
rework_import = require 'rework-importer'
mixins = {
@bolasblack
bolasblack / build.sh
Created June 13, 2014 17:25
build lua support vim on ubuntu
#!/bin/bash -e
sudo apt-get install libncurses5-dev python-dev ruby-dev lua5.2 liblua5.2-dev
./configure \
--enable-fontset \
--disable-xsmp \
--enable-cscope \
--enable-multibyte \
--enable-python3interp \
@bolasblack
bolasblack / task.coffee
Last active August 29, 2015 14:05
OS X 的文件多选逻辑
# 多选的逻辑如下:
# 点击 清空已选中的任务,选中被点击的条目,并记录条目为“最后点击的条目”
# Ctrl/Cmd 不清空已选中的任务,选中被点击的条目,并记录条目为“最后点击的条目”
# Shift 不清空已选中的任务,切换“最后选中的条目”和“点击条目”之间的所有条目的选中状态
# 如果条目在“最后点击的条目”和“点击条目”之间,就选中
# 如果条目不在“最后点击的条目”和“点击条目”之间,就取消选中
$scope.selectTask = do ->
switchTaskSelectStatus = (currTask) ->
visualTasks = _($scope.taskGroups).pluck('tasks').flatten().value()
targetIndex = visualTasks.indexOf currTask
@bolasblack
bolasblack / pomo.coffee
Last active August 29, 2015 14:05
未提交番茄的灾难恢复功能的部分代码
LAST_POMO_START_TIME_STORAGE_KEY = "#{appEdition}_last_pomo_start_time"
getConfirmMessage = ->
alerts =
processing: $i18next("web:pomo.confirm_leaving_processing")
finished: $i18next("web:pomo.confirm_leaving_submit")
alerts[$scope.pomoTimer.status]
$window.$($window).on 'beforeunload', (event) ->
tell application "iTerm2"
activate
set windowCount to count of terminal windows
-- display dialog windowCount as text
if windowCount is 0 then
create window with default profile
delay 0.1
@bolasblack
bolasblack / -wrap-web-service-with-websocket
Last active August 29, 2015 14:08
wrap web service with websocket
nil

Keybase proof

I hereby claim:

  • I am bolasblack on github.
  • I am c4605 (https://keybase.io/c4605) on keybase.
  • I have a public key whose fingerprint is EA86 3E37 3F20 BAD7 42BF A42A C704 6C4E 9F79 C1AB

To claim this, I am signing this object: