Skip to content

Instantly share code, notes, and snippets.

View tsmsogn's full-sized avatar
:octocat:
Set your status

tsmsogn tsmsogn

:octocat:
Set your status
View GitHub Profile
@tsmsogn
tsmsogn / __extends.js
Last active August 18, 2016 16:38
JavaScript: Snippets
var __extends = this.__extends || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
__.prototype = b.prototype;
d.prototype = new __();
};
@tsmsogn
tsmsogn / javascript-extends-function.js
Created December 19, 2012 00:28
JavaScript: Extends function
function extend(target, ref) {
var name, value;
for ( name in ref ) {
value = ref[name];
if (value !== undefined) {
target[ name ] = value;
}
}
return target;
}
@tsmsogn
tsmsogn / UndoManager.js
Created December 19, 2012 06:44
JavaScript: UndoManager
this.sample = this.sample || {};
(function () {
/**
*
* @constructor
*/
var UndoManager = function () {
this.initialize();
#!/usr/local/bin/ruby
# -*- coding: utf-8 -*-
require 'cgi'
filename, = ARGV # path of file `ctype-uca.c'
ctype_uca = File.read(filename)
ctype_uca =~ /^uchar uca_length\[256\]={\n(.*?)};$/m or raise 'uca_length not found'
uca_length = $1.gsub(/\s/,'').split(/,/).map(&:to_i)
@tsmsogn
tsmsogn / gist:4405952
Last active December 10, 2015 08:08
Eclipse: Key
Content Assist: control + command + Space
Debug: command + F11
@tsmsogn
tsmsogn / gist:4467018
Last active December 10, 2015 17:18
[android]Full screen dialog
// 'dialog' is Dialog object
dialog.getWindow().setLayout(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
dialog.show();
@tsmsogn
tsmsogn / gist:4491500
Last active December 10, 2015 20:58
[shell]Snippets
convert -resize 50% -crop 500x100+0+0 original.pdf clone.jpg

現在のフォルダ以下のファイルを一覧表示

find . -type f | while read fileName; do echo ${fileName}; done
@tsmsogn
tsmsogn / GooglePlayServices.java
Last active December 11, 2015 01:28
Android: Snippets
int statusCode = GooglePlayServicesUtil
.isGooglePlayServicesAvailable(getApplicationContext());
if (statusCode == ConnectionResult.SUCCESS) {
Log.v(TAG, "" + statusCode);
} else if (statusCode == ConnectionResult.SERVICE_MISSING
|| statusCode == ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED
|| statusCode == ConnectionResult.SERVICE_DISABLED) {
Log.v(TAG, "" + statusCode);
Dialog dialog = GooglePlayServicesUtil.getErrorDialog(statusCode,
this, 1);
ALTER TABLE `foo` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tsmsogn.samplereceiver" android:versionCode="4"
android:versionName="1.3">
<uses-sdk android:minSdkVersion="7" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<receiver android:name=".Receiver">
<intent-filter>