Skip to content

Instantly share code, notes, and snippets.

@zaki-yama
zaki-yama / MyLightningTab.tab
Last active August 29, 2015 14:20
Lightningコンポーネントのタブをデプロイ
<?xml version="1.0" encoding="UTF-8"?>
<CustomTab xmlns="http://soap.sforce.com/2006/04/metadata">
<auraComponent>MyLightningComponent</auraComponent>
<label>Lightningタブ</label>
<mobileReady>false</mobileReady>
<motif>Custom9: 稲妻</motif>
</CustomTab>
@zaki-yama
zaki-yama / capitalize.cls
Created April 28, 2015 09:59
単語の先頭だけ大文字に変換するメソッド
public static void capitalize(String str){
List<String> words = str.split(' '); // 単語に分ける
List<String> capitalizedWords = new List<String>();
for (String word : words) {
capitalizedWords.add(word.capitalize());
}
return String.join(capitalizedWords, ' ');
}
@zaki-yama
zaki-yama / github-ribbon.html
Created April 4, 2015 15:36
"Fork me on GitHub" Ribbon with Polymer
<link rel="import" href="/bower_components/polymer/polymer.html">
<polymer-element name="github-ribbon" attributes="user repo">
<template>
<style>
a {
background:#000;
color:#fff;
text-decoration:none;
font-family:arial,sans-serif;
@zaki-yama
zaki-yama / json_response_mixin.py
Created March 31, 2015 17:24
DjangoでREST APIを作るためのmixinクラス
# -*- coding: utf-8 -*-
import json
from django.core.serializers.json import DjangoJSONEncoder
from django.http import HttpResponse
class JSONResponseMixin(object):
"""
A mixin that can be used to render a JSON response.
@zaki-yama
zaki-yama / django_login.py
Last active August 29, 2015 14:16
DjangoのClass-based view用@login_required
# -*- coding: utf-8 -*-
from django.http import HttpResponsePermanentRedirect
from google.appengine.api import users
def login_required(handler_method):
u"""Django の Class-based view 用デコレータ
Example:
class MyView(View):
@zaki-yama
zaki-yama / CSVIterator.cls
Last active June 9, 2023 20:53
バッチクラスで CSV ファイルを読み込むサンプル
global with sharing class CSVIterator implements Iterator<String>, Iterable<String> {
private String csvData;
private String rowDelimiter;
public CSVIterator(String fileData, String rowDelimiter) {
this.csvData = fileData;
this.rowDelimiter = rowDelimiter;
}
@zaki-yama
zaki-yama / Code.gs
Last active May 24, 2018 20:08
Google Apps Script (HtmlService) + Polymer でwebアプリケーションのサンプル
<!DOCTYPE html>
<html>
<head>
<script src="//polymerstaticfiles.appspot.com/bower_components/webcomponentsjs/webcomponents.js"></script>
<link rel="import" href="//polymerstaticfiles.appspot.com/bower_components/font-roboto/roboto.html">
<link rel="import" href="//polymerstaticfiles.appspot.com/bower_components/core-header-panel/core-header-panel.html">
<link rel="import" href="//polymerstaticfiles.appspot.com/bower_components/core-toolbar/core-toolbar.html">
<link rel="import" href="//polymerstaticfiles.appspot.com/bower_components/paper-tabs/paper-tabs.html">
<meta name="viewport"
@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();
@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 / ChangeRowColorOnEdit.gs
Created January 28, 2015 04:42
セル編集時に行の色を変更するApps Script
// Enum
var Status = {
FINISHED: '完了',
PROCESSING: '対応中',
PENDING: '保留',
CANCELED: '対応しない'
};
var Color = {
FINISHED: '#ead1dc',