Skip to content

Instantly share code, notes, and snippets.

View tyoshikawa1106's full-sized avatar

Taiki Yoshikawa tyoshikawa1106

View GitHub Profile
@tyoshikawa1106
tyoshikawa1106 / 01_Employee.java
Last active September 5, 2016 04:44
オブジェクト指向サンプル - Java
package jp.co.bbreak.sokusen._1._8._3;
public class Employee {
// 社員名
private String name;
// 役職
private String position;
// 社員名のゲッタ
public String getName() {
return name;
String target = 'Helloooooooooooo!!';
String result = '';
// subString
result = target.substring(0, 5) + '...';
System.debug('subString : ' + result + ' (' + result.length() + ')');
// abbreviate
result = target.abbreviate(8);
System.debug('abbreviate : ' + result + ' (' + result.length() + ')');
@tyoshikawa1106
tyoshikawa1106 / gulpfile.js
Created July 2, 2016 21:23
SalesforceにデプロイするためのGulpfile.js
var gulp = require('gulp');
var zip = require('gulp-zip');
var forceDeploy = require('gulp-jsforce-deploy');
var fs = require('fs');
var path = require('path');
var rename = require("gulp-rename");
// function.getFolders
var getFolders = function (dir) {
return fs.readdirSync(dir)
<aura:component>
<aura:attribute name="expense" type="Expense__c"/>
<p>Amount:
<ui:outputCurrency value="{!v.expense.Amount__c}"/>
</p>
<p>Client:
<ui:outputText value="{!v.expense.Client__c}"/>
</p>
<aura:component >
<aura:attribute name="item" type="Camping_Item__c" required="true" />
<aura:attribute name="packed" type="Boolean" default="false"/>
<ui:outputText value="{!v.item.Name}" />
<ui:outputCheckbox value="{!v.item.Packed__c}" />
<ui:outputCurrency value="{!v.item.Price__c}" />
<ui:outputNumber value="{!v.item.Quantity__c}" />
<ui:button label="Packed!" press="{!c.packItem}" disabled="{!v.Packed}" />
</aura:component>
@tyoshikawa1106
tyoshikawa1106 / StringFormatDemoController.cls
Last active June 27, 2016 06:51
Apex : String.format Demo
public with sharing class StringFormatDemoController {
public StringFormatDemoController() {
this.demo01();
this.demo02();
}
private void demo01() {
String placeholder = 'Hello {0}, {1} is cool!';
List<String> fillers = new String[]{'Jason','Apex'};
@tyoshikawa1106
tyoshikawa1106 / ToolingAPIPost.cls
Created June 19, 2016 10:06
開発者コンソールから動かすTooling API
String requestBody = '{';
requestBody += ' "tests": [';
requestBody += ' {';
requestBody += ' "classId": "01p10000001lEPV",';
requestBody += ' "testMethods": ["Summer16ApexDemoControllerTest1","doSerializeJsonTest1", "doSerializePrettyJsonTest1"]';
requestBody += ' }';
requestBody += ' ]';
requestBody += '}';
System.debug(requestBody);
<!DOCTYPE html>
<html>
<head>
<title>Redux basic example</title>
<script src="https://npmcdn.com/redux@latest/dist/redux.min.js"></script>
</head>
<body>
<div>
<p>
Clicked: <span id="value">0</span> times
@tyoshikawa1106
tyoshikawa1106 / 01_jQueryDeferredDemo.page
Created April 7, 2016 02:54
[ NG ] Apex RemoteAction & jQuery $.ajax
<apex:page controller="jQueryDeferredDemoController" sidebar="false">
<apex:includeScript value="https://code.jquery.com/jquery-2.2.3.min.js" />
<apex:stylesheet value="{!URLFOR($Resource.SLDS100, 'assets/styles/salesforce-lightning-design-system-vf.css')}" />
<apex:include pageName="jQueryDeferredDemoCss" />
<div id="vf-page" class="slds">
<div xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<apex:form id="form">
<button class="slds-button slds-button--brand" id="submitBtn">Demo</button>
<div class="view-panel box-shadow slds-m-top--small">
<div id="target"></div>
@tyoshikawa1106
tyoshikawa1106 / bulkSample1.js
Created March 29, 2016 05:20
JSforce Bulk API Sample Code
batch.on("response", function(rets) { // fired when batch finished and result retrieved
console.log('response');
console.log(rets);
for (var i=0; i < rets.length; i++) {
if (rets[i].success) {
console.log("#" + (i+1) + " loaded successfully, id = " + rets[i].id);
} else {
console.log("#" + (i+1) + " error occurred, message = " + rets[i].errors.join(', '));
}
}