Skip to content

Instantly share code, notes, and snippets.

@ifree
ifree / foxyproxy.js
Last active August 7, 2016 06:01
foxyproxy vimperator plugin
/**
* ==VimperatorPlugin==
* @name foxyproxy.js
* @description foxyproxy helper
* @minVersion 0.1pre
* @author Frei Zhang
* @version 0.1.0
* ==/VimperatorPlugin==
*
* Usage:
@ifree
ifree / article_format.el
Created June 24, 2015 01:17
add space between Chinese and Englisth letters
(defun ifree--format-article (begin end)
"Add space between Chinese and English letters between BEGIN and END."
(interactive "r")
(let (region-begin
region-end
(matcher-begin "\\(?1:[\u4e00-\u9fa5]+\\)\\(?2:[a-zA-Z]+\\)") ;cjk,
;symbols?
(matcher-end "\\(?1:[a-zA-Z]+\\)\\(?2:[\u4e00-\u9fa5]+\\)"))
(if (region-active-p)
@ifree
ifree / tumblesocks-ext.el
Last active August 29, 2015 14:23
Post blog to tumblr with org-mode
(defun ifree-org-html-get-body (&optional buffer)
"Export BUFFER to html body."
(let ((html-content))
(save-excursion
(org-html-export-as-html nil nil t t)
(with-current-buffer "*Org HTML Export*"
(setq html-content
(buffer-substring-no-properties (point-min) (point-max)))
(kill-buffer-and-window)))
html-content))
@ifree
ifree / focus.user.js
Last active August 29, 2015 14:14
focus
// ==UserScript==
// @name site-monit
// @namespace com.ifree.common
// @version 1
// @grant none
// @match *://*.zhihu.com/*
// @match https://*.twitter.com/*
// @match https://*.weibo.com/*
// @match https://plus.google.com/*
// ==/UserScript==
@ifree
ifree / viewer.user.js
Created January 19, 2015 03:29
bt image viewer
// ==UserScript==
// @name image viewer
// @namespace com.ifree.common
// @description image viewer http://slideshow.triptracker.net/index.html
// @include http://bugtracker/bugtracker/*
// @version 1
// @grant none
// ==/UserScript==
(function () {
var MESSAGES = {
@ifree
ifree / save_package.au3
Created January 6, 2015 11:48
auto confirm save upk
#include <Constants.au3>
#include <WinAPI.au3>
#include <Array.au3>
#include <WindowsConstants.au3>
#include <Debug.au3>
_DebugSetup("", True)
Local $win = WinWait("Save Package")
Local $win_handle = WinGetHandle("Save Package")
@ifree
ifree / import_texture.au3
Created January 6, 2015 11:47
bulk import texture into unreal editor
#include <Constants.au3>
#include <WinAPI.au3>
#include <Array.au3>
#include <WindowsConstants.au3>
#include <Debug.au3>
_DebugSetup("", True)
Local $win = WinWait("Import")
Local $num = 0
@ifree
ifree / CMakeLists
Created January 6, 2015 05:29
glconfig
cmake_minimum_required(VERSION 2.8.5)
set(PROJECT_NAME, gl_playground)
#libs
INCLUDE(FindPkgConfig)
PKG_SEARCH_MODULE(GLEW REQUIRED glew)
PKG_SEARCH_MODULE(SDL2 REQUIRED sdl2)
PKG_SEARCH_MODULE(SDL2_image REQUIRED SDL2_image)
PKG_SEARCH_MODULE(GL REQUIRED gl)
@ifree
ifree / js2-remap-array.el
Created June 23, 2014 18:04
eplace array expression with real value
(defun js2-remap-array ()
"replace array expression with real value, eg. arr[1] into 123"
(interactive)
(let*
(
(node (js2-node-at-point))
(current-start (js2-node-abs-pos node))
(current-pos current-start)
(offset 0)
(elems (js2-array-to-list node))
@ifree
ifree / js2-array-node-value.el
Created June 23, 2014 09:13
convert js array to lisp list
(defun js2-array-to-list (&optional node)
"convert array to list"
(let ((node (or node (js2-node-at-point)))
elems)
(unless (js2-var-init-node-p (js2-node-parent node))
(error "invalid node"))
(setq elems (js2-array-node-elems
(js2-var-init-node-initializer
(js2-node-parent node))))
(mapcar (lambda (x) (js2-node-string x)) elems)))