Skip to content

Instantly share code, notes, and snippets.

Taiki Yoshikawa tyoshikawa1106

Block or report user

Report or block tyoshikawa1106

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View StringAbbreviateDemo.cls
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 Jul 2, 2016
SalesforceにデプロイするためのGulpfile.js
View 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)
View expenseItem.cmp
<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>
View campaignListItem.cmp
<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>
View StringFormatDemoController.cls
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 Jun 19, 2016
開発者コンソールから動かすTooling API
View ToolingAPIPost.cls
String requestBody = '{';
requestBody += ' "tests": [';
requestBody += ' {';
requestBody += ' "classId": "01p10000001lEPV",';
requestBody += ' "testMethods": ["Summer16ApexDemoControllerTest1","doSerializeJsonTest1", "doSerializePrettyJsonTest1"]';
requestBody += ' }';
requestBody += ' ]';
requestBody += '}';
System.debug(requestBody);
View react-redex-counter.html
<!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 Apr 7, 2016
[ NG ] Apex RemoteAction & jQuery $.ajax
View 01_jQueryDeferredDemo.page
<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 Mar 29, 2016
JSforce Bulk API Sample Code
View bulkSample1.js
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(', '));
}
}
@tyoshikawa1106
tyoshikawa1106 / server.js
Created Mar 20, 2016
udemyのNode.jsのサンプルのひとつ
View server.js
var http = require('http');
var homepage = `
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title>Simple Server</title>
</head>
<body>
You can’t perform that action at this time.