Skip to content

Instantly share code, notes, and snippets.

@poochin
poochin / numdot.js
Last active December 23, 2015 19:19
codeiq#468 https://codeiq.jp/ace/yuki_hiroshi/q468 の提出コードと出力。 漸化式に頼らず n 番目のナムドット行を計算するようにしています。
var numbase,
numdot_len = 5;
/* Bell 数を計算します */
function bellNumber(n, l) {
var i, cur_l = [], prev_l;
if (l == undefined) {
l = [[1]];
}
if (n <= 1) {
@poochin
poochin / hw.py
Last active December 23, 2015 10:08
数字、文字リテラルを使わずに Hello World を出力する問題 https://codeiq.jp/ace/cielavenir/q431
#!/usr/bin/python
def Hello():_
def World():_
print Hello.__name__,World.__name__
@poochin
poochin / gist:6463763
Last active December 22, 2015 11:09
http://nico.ms/sm21765459 - 【初投稿】ぼくとわたしとニコニコ動画を夏感満載で歌ってみた【幸子】 ‐ ニコニコ動画(原宿) でタグ合戦が起こっていた際に、面白いタグが付けられていたため回収して、ついでなので概要も付けたもの

回収したタグ一覧

  • 期待の新人
  • 期待の本人
  • 擬態の新人
  • 期待の玄人
  • 期待の新神
  • 期待の神々
  • 期待の真神
  • 期待のラスボス
@poochin
poochin / tumblr_tornado.user.js
Last active December 21, 2015 06:08
tumblr tornado で適切に動作しているかメッセージボックスを表示して確認するバージョンです
// ==UserScript==
// @name Tumblr Tornado
// @namespace https://github.com/poochin
// @version 1.2.9.42
// @description Tumblr にショートカットを追加するユーザスクリプト
// @include http://www.tumblr.com/dashboard
// @include http://www.tumblr.com/dashboard?oauth_token=*
// @include http://www.tumblr.com/dashboard/*
// @include http://www.tumblr.com/reblog/*
// @include http://www.tumblr.com/likes
@poochin
poochin / tParser.js
Created May 7, 2013 05:49
代入とイテレートのみ実装したテンプレートエンジンです。 短い行数で欲しかったので書きました。
/**
* Name: tParser
* Desc: Lite template engine (only assign and array iterate)
* License: MIT
* Author: poochin
**/
/**
* 構文:
* {{ A }}: 変数の代入
@poochin
poochin / tumblr_tornado.directReblog.user.js
Last active December 11, 2015 21:09
Tumblr Tornado の試験バージョン
// ==UserScript==
// @name Tumblr Tornado
// @namespace https://github.com/poochin
// @version 1.2.8.10
// @description Tumblr にショートカットを追加するユーザスクリプト
// @include http://www.tumblr.com/dashboard
// @include http://www.tumblr.com/dashboard?oauth_token=*
// @include http://www.tumblr.com/dashboard/*
// @include http://www.tumblr.com/reblog/*
// @include http://www.tumblr.com/likes
@poochin
poochin / fetch2update.js
Last active December 11, 2015 19:08
https://gist.github.com/4645815 を元に reblog 時に http://www.tumblr.com/svc/post/{fetch,update} に送っている内容を post type で共通しているもの、追加されているもの、抜かれているものをコメントアウトで表記しています。 +type はその type でのみ現れるもの、-type はその type では現れないものです。 全部記述すると長くなってしまうので、短くなるように+-を使用しています。
/* fetch から複製できるもの */
{
"error":, false,
"created_post": true,
"context_page": false /* "dashboard" */,
"post_context_page": "dashboard",
"post": {} /* -post */
}
/* fetch.post から複製できるもの */
/* fetch */
{
"errors": false,
"post": {
"id": null,
"two": "",
"three": "http:\/\/soundcloud.com\/iosysos\/zedd-clarity-feat-foxes-denpa",
"state": 0,
"publish_on": false,
"type": "audio",
// Tumblr reblogフォームの変更により対応(中)のパッチ
// photoでテストしてて http://www.tumblr.com/svc/post/update で403が返ってくる途中の状態
// あと fetchが重い(というかfetchの必要ない(?)
(function() {
update(Tombloo.Service.extractors['ReBlog - Dashboard'], {
extract : function(ctx) {
return Tombloo.Service.extractors.ReBlog.extractByLink(ctx, this.getLink(ctx)).addCallback(function(res) {
var expr = './ancestor-or-self::li[starts-with(normalize-space(@class), "post")]' +
'//a[starts-with(@href,"/reblog/")]';
@poochin
poochin / gist:4642974
Created January 26, 2013 15:46
新dsbdの新規投稿
new Ajax.Request('http://www.tumblr.com/svc/post/update',
{
method: 'post',
parameters: '{"form_key":"' + document.body.getAttribute('data-form-key') + '","context_id":"","context_page":"dashboard","is_rich_text[one]":"0","is_rich_text[two]":"0","is_rich_text[three]":"0","channel_id":"' + $$('#popover_blogs .popover_menu_item:not(#button_new_blog)')[0].id.slice(9) + '","post[slug]":"","post[draft_status]":"","post[source_url]":"http://","post[date]":"","post[type]":"regular","post[one]":"test","post[two]":"test","post[tags]":"","post[publish_on]":"","post[state]":"1","custom_tweet":"test - test [URL]"}',
requestHeaders: ['Content-Type', 'application/json']
})