Skip to content

Instantly share code, notes, and snippets.

@zaki-yama
zaki-yama / custom_template_tags.templatetags.current_time.py
Created October 20, 2014 13:08
[django] カスタムテンプレートタグ
# -*- coding: utf-8 -*-
import datetime
from django import template
register = template.Library()
# これかデコレータ(@register.tag)によってタグを登録する
# register.tag('current_time', do_current_time)
@zaki-yama
zaki-yama / QueryingDeletedRows.cls
Last active August 29, 2015 14:10
[Salesforce] 削除済みレコードの取得
List<Event> events = [
select
id,
subject,
startdatetime,
isdeleted
from
Event
order by
createddate desc
@zaki-yama
zaki-yama / sample.py
Created December 5, 2014 08:12
[python]さんぷる
# -*- coding: utf-8 -*-
from datetime import datetime
d1 = datetime.now()
#!/bin/bash
if [ -e Brewfile ]; then
echo "Brewfile already exists. Please rename or remove it."
exit
fi
for i in $(brew list)
do
echo "install $i"
@zaki-yama
zaki-yama / DailyEmailGovernorChecker.cls
Last active August 29, 2015 14:13
[Salesforce] 今日あと何通Apexでメール送信できるのか?を取得
Integer count = 0;
while (true) {
try {
Messaging.reserveSingleEmailCapacity(1);
count++;
} catch (Exception e) {
System.debug(LoggingLevel.INFO, 'メール送信可能回数はあと ' + count + ' 回');
break;
}
}
@zaki-yama
zaki-yama / .vimrc
Created January 23, 2015 05:34
taglistの設定
" taglist {{{
NeoBundle 'vim-scripts/taglist.vim'
set tags=tags
let Tlist_Ctags_Cmd = "/usr/local/bin/ctags"
let Tlist_Show_One_File = 1
let Tlist_Use_Right_Window = 1
let Tlist_Exit_OnlyWindow = 1
" http://yuku-tech.hatenablog.com/entry/20111012/1318416494
let g:tlist_javascript_settings = 'javascript;c:class;m:method;F:function;p:property'
@zaki-yama
zaki-yama / models.py
Created January 25, 2015 10:35
Google App Engine + django で Google Tasks API を使う(2) 認証とリダイレクトまで
# -*- coding: utf-8 -*-
from google.appengine.ext import ndb
from oauth2client.appengine import CredentialsNDBProperty
class CredentialsModel(ndb.Model):
credentials = CredentialsNDBProperty()
@zaki-yama
zaki-yama / ChangeRowColorOnEdit.gs
Created January 28, 2015 04:42
セル編集時に行の色を変更するApps Script
// Enum
var Status = {
FINISHED: '完了',
PROCESSING: '対応中',
PENDING: '保留',
CANCELED: '対応しない'
};
var Color = {
FINISHED: '#ead1dc',
@zaki-yama
zaki-yama / index.html
Last active August 29, 2015 14:14
Google App Engine + django で Google Tasks API を使う(3) とりあえずTaskを表示できるところまで
<!DOCTYPE html>
<html>
<body>
<ul>
{% for task in tasks %}
<li>
{{ task.title }}
</li>
{% endfor %}
</body>
@zaki-yama
zaki-yama / CreatedDateTest.cls
Last active August 29, 2015 14:14
CreatedDateでのソートはアテにならない
@isTest
public class CreatedDateTest {
public static testMethod void run() {
Account a = new Account();
a.Name = 'Account # 1';
insert a;
System.debug(LoggingLevel.INFO, 'A\'s id: ' + a.id);
Account b = new Account();