Skip to content

Instantly share code, notes, and snippets.

@t-kashima
t-kashima / a.png
Last active December 27, 2015 06:19
Yammerの表示から指定した要素を削除します。 content_script.jsのHIDE_ID_LISTで要素を指定して下さい。
a.png
@t-kashima
t-kashima / HelloWorld.cpp
Last active December 26, 2015 14:58
白いスプライトをオリジナルのスプライトの上にはりつける
// AppController.mm
//
// depthFormat: GL_DEPTH24_STENCIL8
//
// -----------------------------------------------------------
// CCSprite* sprite = CCSprite::create("HelloWorld.png");
// this->addChild(sprite);
// sprite->setPosition(ccp(size.width / 2, size.height / 2));
// sprite->setScale(0.5f);
//
<?php
$imageurl = 'http://farm3.staticflickr.com/2844/9898243895_8ba3267d5a_o.jpg';
$filename = 'tmp.jpg';
$tmp = file_get_contents($imageurl);
if ($tmp) {
$fp = fopen($filename, 'w');
fwrite($fp, $tmp);
fclose($fp);
}
@t-kashima
t-kashima / a-screenshot.png
Last active December 23, 2015 17:19
選択した英単語を日本語に変換するChrome Extension
a-screenshot.png
# -*- coding: utf-8 -*-
require 'rubygems'
require 'json/pure'
require 'net/https'
require 'uri'
require 'nokogiri'
require 'open-uri'
# Yahoo APIのAPI KEY
APIKEY = ''
# -*- coding: utf-8 -*-
class Colors
def Colors.getArrayFromString(str, num)
colors = str.unpack(("a" + num.to_s) * (str.length / 2))
colors = colors.collect{|color|
color.hex
}
return colors
end
@t-kashima
t-kashima / a-screenshot.png
Last active December 23, 2015 04:39
ZOZOPocket (ZOZOTOWN MEMO SYSTEM)
a-screenshot.png
@t-kashima
t-kashima / GB2ShapeCache-x.cpp
Created June 30, 2013 13:25
I add this method in GB2ShapeCache-x.cpp. Because it don't think a sprite scale.
void GB2ShapeCache::addFixturesToBodyForSprite(b2Body *body, const std::string &shape, CCSprite *sprite) {
std::map<std::string, BodyDef *>::iterator pos = shapeObjects.find(shape);
BodyDef *so = (*pos).second;
FixtureDef *fix = so->fixtures;
if ((sprite->getScaleX() == 1.0f) && (sprite->getScaleY() == 1.0f)) {
// simple case - so do not waste any energy on this
while(fix) {
body->CreateFixture(&fix->fixture);
fix = fix->next;
@t-kashima
t-kashima / nageru.cs
Created June 7, 2013 03:10
なげる
void OnDrag(Vector2 delta) {
Vector2 mousePoint = UICamera.currentCamera.ScreenToWorldPoint(UICamera.lastTouchPosition);
double radian = Math.Atan2(-1 * mousePoint.y, -1 * mousePoint.x);
moveX = (float)Math.Cos(radian) * 60;
moveY = (float)Math.Sin(radian) * 60;
}
void OnMouseUp() {
rigidbody.AddForce (moveX, moveY, 0);
}
HTTP.Request request = new HTTP.Request( "get", "echo.php?data=test");
request.synchronous = true;
request.Send((data) => {
print(data.response.Text);
JSONObject json = new JSONObject(data.response.Text);
int status = int.Parse(json.GetField("status").ToString());
if (status == 200) {
JSONObject responseObj = json.GetField("response");
print (AES.decrypt(responseObj.str));
} else {