Skip to content

Instantly share code, notes, and snippets.

View watagashi's full-sized avatar
🏠
Working from home, except for the weekend.

WADA Takashi watagashi

🏠
Working from home, except for the weekend.
View GitHub Profile
@watagashi
watagashi / jsdoit.css
Created September 4, 2013 13:53
2013-09-04 1st
* {
margin: 0;
padding: 0;
border: 0;
}
body {
background: #ddf;
font: 30px sans-serif;
}
<?php
// put your code here
/*
header("HTTP/1.0 200");
header("Content-Type: video/quicktime;");
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
function quoteStatus(id, user, ele) {
id = id || popup_id;
user = user || popup_user;
ele = ele || popup_ele;
if (!id) return false;
if ($('lock-' + ele.id) && !confirm(_("This tweet is protected; Are you sure to retweet?"))) return false;
var tw = !display_as_rt && ele.tw.retweeted_status || ele.tw;
$('fst').value = twitterURL.replace('http', 'https') + "#!/" + user + "/statuses/"+ id + " RT @"+user+": " + charRef(tw.text);
$('fst').focus(); $('fst').select();
return false;
[extensions]
hgext.zipdoc =
[encode]
# Office Open XML
**.docx = zipdocencode
**.docm = zipdocencode
**.dotx = zipdocencode
**.dotm = zipdocencode
**.xlsx = zipdocencode
@watagashi
watagashi / string.js
Created September 8, 2011 14:04
#tkbjs p.101-
// p.101
// String
var name= 'Curly';
var initial = name.charAt(0);
var s = 'C'.concat('a', 't');
var text = 'Mississippi';
var p = text.indexOf('ss');
p = text.indexOf('ss', 3);
@watagashi
watagashi / method.js
Created September 8, 2011 13:15
Online Study TokyoBouldering.js – Lingr http://lingr.com/room/tkbjs/
Function.prototype.method = function (name, func) {
if (!this.prototype[name]) {
this.prototype[name] = func;
return this;
}
};
String.method('entityify', function () {
var character = {
'<' : '&lt;',
function press(e) {
if (e != 1) key_press_detected = true;
if (e != 1 && (e.keyCode != 13 && e.keyCode != 10 ||
!decr_enter && (e.ctrlKey || e.shiftKey) || decr_enter && !(e.ctrlKey || e.shiftKey)) )
return true;
var st = document.frm.status;
if (!key_press_detected) st.value = st.value.replace(/\n/g, "");
if (st.value == '') {
update();
return false;
registerPlugin({
newMessageElement: function(elem, tw) {
tw = tw.retweeted_status || tw;
if (tw.entities && tw.entities.media) {
for (var i = 0; i < tw.entities.media.length; i++) {
if (tw.entities.media[i].type == "photo") {
addThumbnail(elem,
tw.entities.media[i].media_url + ":thumb",
tw.entities.media[i].media_url + ":large");
}
@watagashi
watagashi / measuresapierror.js
Created July 28, 2011 15:23
twicli plugin, measures againt API errror
function twAuthFallback() {
// verify_credentials API is unavailable?
re_auth = true;
xds.load_default(twitterAPI + "users/show.json?suppress_response_codes=true&screen_name="+myname, twAuth);
}
function auth() {
if (use_ssl)
twitterAPI = twitterAPI.replace('http', 'https');
var name = readCookie('access_user');
if (name) {
var n = [4, 8, 15, 23, 42];
n.sort();
n.sort(function(a, b) {
return a-b;
});
var m = ['aa', 'bb', 'a', 4, 8, 15, 16, 23, 42];
m.sort(function(a, b) {
if (a === b) {
return 0;
}