Skip to content

Instantly share code, notes, and snippets.

View nutti's full-sized avatar

nutti nutti

View GitHub Profile
@nutti
nutti / marked_and_highlight.js
Created February 25, 2015 12:25
[Javascript] marked.js and highlight.js
marked.setOptions({
langPrefix: ''
});
var html = marked(src);
$('#src').html(html);
$('#src pre code').each(function(i, block) {
hljs.highlightBlock(block, block.className);
});
@nutti
nutti / highlight_usage.html
Last active August 29, 2015 14:16
[Javascript] highlight.js
<link rel="stylesheet" href="css/ext/github.css" type="text/css" />
<script type="text/javascript" src="js/ext/highlight.pack.js"></script>
@nutti
nutti / marked_usage.html
Created February 25, 2015 12:18
[Javascript] marked.js
<script type="text/javascript" src="marked.js"></script>
@nutti
nutti / qiita_access_token.js
Last active August 29, 2015 14:16
[PhoneGap] Get OAuth's access token in Qiita
var params = {
'client_id': clientID, // 登録したアプリのクライアントID
'client_secret': clientSecret, // 登録したアプリのクライアントシークレット
'code': code // リダイレクトURLのクエリのcodeの値
};
$.ajax({
url: getAPIURL('https://qiita.com/api/v2/access_tokens'),
type: 'POST',
headers: {
@nutti
nutti / event_listener.js
Created February 23, 2015 12:58
InAppBrowser Event Listener
self.cb = window.open(url, '_blank', 'location=no,toolbar=no,clearsessioncache=yes');
self.cb.addEventListener('loadstart', function(e) {
var loc = e.url;
if (loc.indexOf(REDIRECT_URL) != -1) {
// 認可完了後の処理
return;
}
});
@nutti
nutti / install_phonegap_plugin.sh
Last active August 29, 2015 14:15
[PhoneGap/Cordova] 古いバージョンのプラグインをインストールする方法 ref: http://qiita.com/nutti/items/0b31939dc9a815d763aa
$ cordova plugin add [プラグインのID]
@nutti
nutti / get_contrib_list_with_secret.js
Created February 17, 2015 12:44
Qiitaから特定ユーザの投稿の一覧を取得する(限定共有投稿も取得)
var user = 'YOUR_NAME'; // ユーザ名
var access_token = 'YOUR_ACCESS_TOKEN'; // アクセストークン
$.ajax({
url: 'https://qiita.com/api/v1/users/' + user + '/items?token=' + access_token,
type: 'GET',
dataType: 'json',
scriptCharset: 'utf-8',
success: function(res) {
// 成功した時の処理
@nutti
nutti / get_contrib_list.js
Last active August 29, 2015 14:15
Qiitaから特定ユーザの投稿の一覧を取得する
var user = 'YOUR_NAME'; // ユーザ名
$.ajax({
url: 'https://qiita.com/api/v1/users/' + user + '/items',
type: 'GET',
dataType: 'json',
scriptCharset: 'utf-8',
success: function(res) {
// 成功した時の処理
},
@nutti
nutti / custom_zepto.sh
Last active August 29, 2015 14:15
Customize zepto.js
$ git clone https://github.com/madrobby/zepto.git
$ cd zepto
$ npm install
$ MODULES="zepto event ajax form ie touch" npm run-script dist
$ ls dist
zepto.js zepto.min.gz zepto.min.js
@nutti
nutti / get_edge_selection_sequence.py
Last active August 29, 2015 14:14
[Blender] オブジェクトの頂点・辺・面の選択順序を取得する方法 ref: http://qiita.com/nutti/items/384109ec6ed6d4a2e9f9
import bpy
import bmesh # 追加でインポートが必要
obj = bpy.context.active_object
bpy.ops.object.mode_set(mode='EDIT') # 処理はEDITモードで行う必要がある
bm = bmesh.from_edit_mesh(obj.data)
# blenderのバージョンが2.73以上の時に必要
if bpy.app.version[0] >= 2 and bpy.app.version[1] >= 73: