Skip to content

Instantly share code, notes, and snippets.

@ifree
ifree / js2r-unescape.el
Last active August 29, 2015 14:02
convert hex or unicode encoded string to normal string
;(decode-coding-string "keywork" 'utf-8)
(defun js2-unescape (b)
"convert hex or unicode encoded string to normal string"
(interactive "bselect buffer ")
(let*
((hex-pattern "\\\\x\\(\\w+\\)")
(unicode-pattern "\\\\u\\(\\w+\\)")
(process
#'(lambda (p)
(with-current-buffer b
@ifree
ifree / js2r.ext.el
Last active August 29, 2015 14:02
rename js variable in lexical scope
(defun js2r-rename-var (replacement)
"Renames the variable on point and all occurrences in its lexical scope."
(interactive "sInput the replacement: ")
; (js2r--guard)
(let* ((current-node (js2r--local-name-node-at-point))
(len (js2-node-len current-node))
(offset (- (length replacement) len))
(current-start (js2-node-abs-pos current-node))
(current-end (+ current-start len)))
@ifree
ifree / custom_rules.xml
Created June 20, 2014 09:20
#ant script to manipulate androidmanifest.
<?xml version="1.0" encoding="UTF-8"?>
<project name="android-build-mate" default="help">
<property name="manifest">AndroidManifest</property>
<target name="reconfig"> <!--require arguments: tex=etc, pvrtc, etc.. platform=a,g -->
<condition property="dest-manifest" value="${manifest}_${platform}_${tex}.xml">
<and>
<isset property="tex"/>
<isset property="platform"/>
</and>
@ifree
ifree / jni-string.c
Last active August 29, 2015 14:02
#jni string functions
// UTF-8 String (encoded to 1-3 byte, backward compatible with 7-bit ASCII)
// Can be mapped to null-terminated char-array C-string
const char * GetStringUTFChars(JNIEnv *env, jstring string, jboolean *isCopy);
// Returns a pointer to an array of bytes representing the string in modified UTF-8 encoding.
void ReleaseStringUTFChars(JNIEnv *env, jstring string, const char *utf);
// Informs the VM that the native code no longer needs access to utf.
jstring NewStringUTF(JNIEnv *env, const char *bytes);
// Constructs a new java.lang.String object from an array of characters in modified UTF-8 encoding.
jsize GetStringUTFLength(JNIEnv *env, jstring string);
// Returns the length in bytes of the modified UTF-8 representation of a string.
@ifree
ifree / svn_version.ps1
Created December 17, 2013 08:13
print svn version
[xml](svn info -R $path --xml).info.entry|? {[int]$_.commit.revision -gt 214 -and $_.path -like "*.hpp"}|%{$_.commit.revision+":"+$_.path}
@ifree
ifree / notify.ps1
Created December 16, 2013 07:40
powershell growlnotify
function notify()
{
iex ($args -join " ")
growlnotify "/a:shell" "/n:shell.message" "/r:shell.message" "/t:shellnotify" "command execute succesfully"
}
@ifree
ifree / gist:7925084
Created December 12, 2013 09:02
filter out only changed files in svn
svn log -r0:HEAD -q -v svn://repo.addr |grep "M /trunk/xxx/.*el$"/|uniq
@ifree
ifree / vc.el
Created November 7, 2013 10:14
setup emacs vc environment
(defun setup-cc-path()
(let (pathes libpath)
(if (eq system-type 'windows-nt)
(progn
(setq pathes `(
"C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin"
"C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE"
"C:/Program Files/Microsoft Visual Studio 10.0/Common7/IDE"
"C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/Tools"
"C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/include"
@ifree
ifree / Console.as
Created October 27, 2013 15:29
simple console for as3
package com.ifree.common
{
import flash.display.Sprite;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.text.TextFieldType;
import flash.text.TextFormat;
import flash.ui.Keyboard;
@ifree
ifree / upk reader
Created October 22, 2013 14:17
small util get reading upk info
#
# utils for get information of upk file
# http://wiki.beyondunreal.com/Legacy:Package_File_Format
DWORD = 4
WORD = 2
GUID = 16