Skip to content

Instantly share code, notes, and snippets.

@cloverrose
cloverrose / faces.el
Created June 8, 2013 02:16
Emacs24 default faces
bold
bold-italic
border
buffer-menu-buffer
button
completions-annotations
completions-common-part
completions-first-difference
cursor
default
@cloverrose
cloverrose / tabbar-sample.el
Created April 15, 2013 09:37
tabbar.elの設定
;; tabbar.el
(require-submodule 'tabbar)
(tabbar-mode 1)
;; グループ化しない
(setq tabbar-buffer-groups-function nil)
;; 左に表示されるボタンを無効化
(dolist (btn '(tabbar-buffer-home-button
tabbar-scroll-left-button
tabbar-scroll-right-button))
(set btn (cons (cons "" nil)
@cloverrose
cloverrose / whitespace_sample.el
Created April 11, 2013 19:16
全角スペース タブ 行末スペースを目立たせる設定 全角スペースは□ タブは» 行末スペースにはアンダーライン
;; 全角スペース タブ trailing-spacesを目立たせる
(require 'whitespace)
;; space-markとtab-mark、それからspacesとtrailingを対象とする
(setq whitespace-style '(space-mark tab-mark face spaces trailing))
(setq whitespace-display-mappings
'(
;; (space-mark ?\ [?\u00B7] [?.]) ; space - centered dot
(space-mark ?\xA0 [?\u00A4] [?_]) ; hard space - currency
(space-mark ?\x8A0 [?\x8A4] [?_]) ; hard space - currency
(space-mark ?\x920 [?\x924] [?_]) ; hard space - currency
@cloverrose
cloverrose / twitter_urlize_filter.py
Created February 25, 2013 14:19
Djangoのテンプレートで使えるカスタムフィルター| Django標準のurlizeフィルターはURLの前後に空白を必要としたり、target="_blank"がつかない。このフィルターでは、前後に空白がないURL、さらに@や#についてもURLにする。#の正規表現は http://d.hatena.ne.jp/sutara_lumpur/20101012/1286860552を参考に、@の正規表現はTwitterの動作から推定した
# -*- coding:utf-8 -*-
# python
import re
# Django
from django import template
register = template.Library()
from django.template.defaultfilters import stringfilter
@cloverrose
cloverrose / toggle_card.html
Last active December 10, 2015 16:18
クリックするとカードが裏返る jQuery, jQuery-ui, jQuery pluginのflip (http://lab.smashup.it/flip/), bootstrapが必要
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8" />
<title>Toggle Card</title>
<meta name="viewport" content="width=device-width, initital-scale=1.0">
<!-- bootstrap-css start -->
<link href="http://sandboxofcloverrose.appspot.com/css/bootstrap.min.css" rel="stylesheet">
<link href="http://sandboxofcloverrose.appspot.com/css/bootstrap-responsive.min.css" rel="stylesheet">
<!-- bootstrap-css end -->
@cloverrose
cloverrose / jQuery_problem_memo.js
Created January 5, 2013 03:05
DIV要素にdata-toggleアトリビュートを設定してtrue/falseを切り替えようと思ったらうまく行かなかった。 0/1にしたらうまく行った。同じ事態にならないようにメモ
function dotoggle(_this_){
toggle = _this_.attr('data-toggle');
if(toggle === void 0){
toggle = 0;
//toggle = false;
}else{
toggle = parseInt(toggle);
//toggle = Boolean(toggle);
}
console.log(toggle);
@cloverrose
cloverrose / mustach_filter.html
Last active December 10, 2015 09:18
Try to implement original filter/tag like Django's ifchanged etc.
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>sandbox of mustache</title>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="http://twitter.github.com/hogan.js/builds/2.0.0/hogan-2.0.0.js"></script>
<script type="text/template" id="source">
<ul>
{{#items}}
@cloverrose
cloverrose / timezone.py
Created December 14, 2012 15:26
timezonでJSTにするのはよく使うので
# -*- coding: utf-8 -*-
import datetime
# 日本時間
class JST(datetime.tzinfo):
"""
日本時間で作成
japan_time = datetime.datetime.now(jst)
@cloverrose
cloverrose / deploy_heroku_django
Created December 12, 2012 16:39
DjangoプロジェクトをHerokuにデプロイする際の変更箇所
[Procfile]
+web: python twhyou/manage.py runserver 0.0.0.0:$PORT --noreload
[requirements.txt]
+Django==1.4.2
+psycopg2==2.4.5
+tweepy==1.12
+wsgiref==0.1.2
[myproj/myproj/settings.py]
@cloverrose
cloverrose / Logon_Logoff
Created November 5, 2012 08:22
Windows7, Logon and Logoff filter
<QueryList>
<Query Id="0" Path="Security">
<Select Path="Security">
(*[System[(EventID=4647)]]) or
(*[System[(EventID=4624)]] and
*[EventData[Data[@Name='ProcessName']='C:\Windows\System32\winlogon.exe']] and
(*[EventData[Data[@Name='TargetUserName']='user1']] or
*[EventData[Data[@Name='TargetUserName']='user2']] or
*[EventData[Data[@Name='TargetUserName']='user3']]) and