Skip to content

Instantly share code, notes, and snippets.

View yujikosuga's full-sized avatar
🐈
"'/x/></title></script><x></x\

Yuji Kosuga "'/x=/></script></title><x><x/ yujikosuga

🐈
"'/x/></title></script><x></x\
View GitHub Profile
@yujikosuga
yujikosuga / unicode_range_map.js
Created September 5, 2011 10:11
Unicode code range map
var UNICODE_RANGE_MAP = {
BAIDC_LATIN : [ 0x00, 0x7F ],
LATIN_1_SUPPLEMENT : [ 0x80, 0xFF ],
LATIN_EXTENDED_A : [ 0x100, 0x17F ],
LATIN_EXTENDED_B : [ 0x180, 0x24F ],
IPA_EXTENIONS : [ 0x250, 0x2AF ],
SPACING_MODIFIER_LETTERS : [ 0x2B0, 0x2FF ],
COMBINDING_DIACRITICAL_MARKS : [ 0x300, 0x36F ],
GREEK_AND_COPTIC : [ 0x370, 0x3FF ],
CYRILLIC : [ 0x400, 0x4FF ],
@yujikosuga
yujikosuga / jQueryUI_addUiState.js
Created September 5, 2011 14:01
Add UI state change in jQuery UI (I used this for buttons)
$.fn.addUiState = function() {
$(this).hover(function() {
$(this).addClass("ui-state-hover");
}, function() {
$(this).removeClass("ui-state-hover");
}).mousedown(function() {
$(this).addClass("ui-state-active");
}).mouseup(function() {
$(this).removeClass("ui-state-active");
});
@yujikosuga
yujikosuga / facebook_post_search.js
Created September 13, 2011 10:03
An example of facebook post search with retrieving user profile pictures
var keyword = 'KEYWORD';
FB.api('/search?q=' + keyword + '&type=post', {
limit : 10
}, function(response) {
var content = '';
var data = response.data;
for ( var i in data) {
var icon = '';
var nameSpan = '';
@yujikosuga
yujikosuga / HttpUtils.java
Created September 19, 2011 00:46
An HTTP utility library in Java
package com.yujikosuga.http;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
/**
* This HttpUtils class has static utility methods for HTTP manipulation.
@yujikosuga
yujikosuga / ButtonPref.java
Created September 22, 2011 08:05
Add a button to a PreferenceScreen (Android)
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.pref_button);
...
Preference pref = findPreference("sample_key");
pref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
// TODO Auto-generated method stub
@yujikosuga
yujikosuga / decrease_padding_top_animation.java
Created November 20, 2011 06:37
Android resize animation with no Animation class
/* Decrease the padding top size. */
int update_interval_millis = 25;
int decrease_size_per_interval = 10;
int toSize = 100;
View view;
final Handler handler = new Handler();
Runnable runnable = new Runnable() {
@Override
@yujikosuga
yujikosuga / JarExtractor.java
Created December 21, 2011 13:46
Extract children jar files inside of a jar file (which is often a self-contained executable jar file)
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.;
import java.i FileOutputStream o.IOException;
import java.util.Enumeration;
import java.util.jar.JarFile;
import java.util.zip.ZipEntry;
/**
@yujikosuga
yujikosuga / example_post4a.js
Created December 21, 2011 14:33
An example of post4a.js
<a href="http://www.yujikosuga.com/httpParams.php"
class="post4a"
data-postdata='{"userid":"43ec7d99d05064.98961542", "lang":"en"}'>
HTTP Environment Checker
</a>
@yujikosuga
yujikosuga / erroneous.xml
Created December 22, 2011 01:23
InvalidArtifactRTException thrown in maven-assembly-plugin
<plugin>
<groupid>org.apache.maven.plugins</groupid>
<artifactid>maven-assembly-plugin</artifactid>
<configuration>
<finalname>${project.build.finalName}</finalname>
<descriptorrefs>
<descriptorref>jar-with-dependencies</descriptorref>
</descriptorrefs>
<appendassemblyid>false</appendassemblyid>
</configuration>
@yujikosuga
yujikosuga / otool.txt
Created December 22, 2011 01:58
otool: objdump provided for Mac
otool: at least one file must be specified
Usage: otool [-fahlLDtdorSTMRIHvVcXm] <object file> ...
-f print the fat headers
-a print the archive header
-h print the mach header
-l print the load commands
-L print shared libraries used
-D print shared library id name
-t print the text section (disassemble with -v)
-p <routine name> start dissassemble from routine name