Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:

高見知英 TakamiChie

:octocat:
View GitHub Profile
View AssetInstaller.java
/**
* http://outcesticide.hatenablog.com/entries/2012/12/12
* の記事を参考にしています。
*/
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
@TakamiChie
TakamiChie / wallpaper.py
Created May 21, 2013
Python Image Libraryで水玉模様の壁紙作成 ref: http://qiita.com/items/3623a4771a22e85839e9
View wallpaper.py
# -*- coding: utf-8 -*-
from PIL import Image
from PIL import ImageDraw
import colorsys
import sys
### http://code.activestate.com/recipes/266466-html-colors-tofrom-rgb-tuples/history/2/
def RGBToHTMLColor(rgb_tuple):
""" convert an (R, G, B) tuple to #RRGGBB """
hexcolor = '#%02x%02x%02x' % rgb_tuple
@TakamiChie
TakamiChie / NextMottoMotto
Created Jul 3, 2013
次のもっともっと交流ステーションの日付を表示するスニペット ref: http://qiita.com/TakamiChie/items/94742b098c2bb5ef4216
View NextMottoMotto
<?php
/*
* NextMottoMotto
* Author:高見知英( http://onpu-tamago.net/ )
* 次のもっともっと交流ステーションの日付を取得するスニペット
*/
if(!isset($format)) {
$format="Y/m/d";
}
View Animation.java
protected float resolveSize(int type, float value, int size, int parentSize) {
switch (type) {
case ABSOLUTE:
return value;
case RELATIVE_TO_SELF:
return size * value;
case RELATIVE_TO_PARENT:
return parentSize * value;
default:
return value;
@TakamiChie
TakamiChie / TranslateAnimationEx.java
Created Sep 20, 2013
TranslateAnimationを動的に設定しやすくするクラスを作ってみました ref: http://qiita.com/TakamiChie/items/8089aa142d033b613d80
View TranslateAnimationEx.java
public class TranslateAnimationEx extends TranslateAnimation implements
AnimationListener {
private AnimationListener mListener;
private View mView;
private int mFromX;
private int mFromY;
private int mToX;
private int mToY;
@TakamiChie
TakamiChie / SavePictureRunner
Created Sep 29, 2013
ビューのスクリーンショットを保存する ref: http://qiita.com/TakamiChie/items/a41eeb12f1e1e8a845f9
View SavePictureRunner
public class SavePictureRunner implements Runnable {
private File mFileName;
private View mView;
public SavePictureRunner(View view, File filename) {
this.mView = view;
this.mFileName = filename;
}
@Override
View FlashAirStateChanger.uws
dim fso = CREATEOLEOBJ("Scripting.FileSystemObject")
for i = 0 to GETOLEITEM(fso.Drives) - 1
// ドライブの検索(リムーバブルかつ、制御用画像が存在するか?)
dim d = ALL_OLE_ITEM[i]
PRINT d.DriveLetter + ": Type " + d.DriveType
IFB d.DriveType = 1 THEN
PRINT "found " + d.path
dim path = fso.buildPath(fso.buildPath(fso.buildPath(d.path, "DCIM"), "100__TSB"), "FA000001.JPG")
PRINT "path " + path
IFB fso.FileExists(path) THEN
@TakamiChie
TakamiChie / GitCommit.js
Created Dec 19, 2013
GinnieからGitExtensionsを起動しコミットするスクリプト ref: http://qiita.com/TakamiChie/items/8b5881c9d2dbe3a6d28c
View GitCommit.js
var wsh = new ActiveXObject("WScript.Shell");
var fso = new ActiveXObject("Scripting.FileSystemObject");
var command = App.ParamCount > 0 ? App.Params(0) : "commit";
var path = fso.buildPath(wsh.RegRead("HKCU\\Software\\GitExtensions\\InstallDir"), "GitExtensions.exe")
if(fso.fileExists(path)){
// .gitフォルダを探索
var doc = Documents.newDocument();
if(doc.save()){
var folder = fso.getFolder(fso.getParentFolderName(doc.fileName))
try{
View MediaStoreに登録されていない画像である場合
File file = /* 適当なFile(外部ストレージ上に保存している画像であること) */
ContentResolver cr = context.getContentResolver();
ContentValues cv = new ContentValues();
cv.put(MediaStore.Images.Media.TITLE, file.getName());
cv.put(MediaStore.Images.Media.DISPLAY_NAME, file.getName());
cv.put(MediaStore.Images.Media.DATE_TAKEN, System.currentTimeMillis());
cv.put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg");
cv.put(MediaStore.Images.Media.DATA, file.getAbsolutePath());
Uri uri = cr.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, cv);
View サムネイル用の画像を先行表示する
Bitmap thumbnail = $.getCachedImage(thumbnailUrl.toString());
$.id(R.id.image).image(url.toString(), false, false, 0, 0, thumbnail, 0);