Skip to content

Instantly share code, notes, and snippets.

View tyoshikawa1106's full-sized avatar
🗼
TOKYO, JAPAN

Taiki Yoshikawa tyoshikawa1106

🗼
TOKYO, JAPAN
View GitHub Profile
@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(', '));
}
}
@tyoshikawa1106
tyoshikawa1106 / server.js
Created March 20, 2016 06:02
udemyのNode.jsのサンプルのひとつ
var http = require('http');
var homepage = `
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title>Simple Server</title>
</head>
<body>
@tyoshikawa1106
tyoshikawa1106 / karma.conf.js
Created March 15, 2016 07:48
Karmaのテスト
// Karma configuration
// Generated on Tue Mar 15 2016 16:19:43 GMT+0900 (JST)
module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
@tyoshikawa1106
tyoshikawa1106 / UpdateParentAccount.cls
Created March 9, 2016 08:46
Queueableサンプル
public class UpdateParentAccount implements Queueable {
private List<Account> accounts;
private ID parent;
public UpdateParentAccount(List<Account> records, ID id) {
this.accounts = records;
this.parent = id;
}
public class LeadProcessor implements Database.Batchable<sObject>, Database.Stateful {
/**
* コンストラクタ
*/
public LeadProcessor() {
}
/**
public class AccountProcessor {
@future
public static void countContacts(List<Id> accountIds) {
List<Account> accounts = [SELECT Id,(SELECT Id FROM Contacts) FROM Account WHERE Id IN: accountIds];
for (Account a : accounts) {
a.Number_of_Contacts__c = a.Contacts.size();
}
if (!accounts.isEmpty()) {
update accounts;
@tyoshikawa1106
tyoshikawa1106 / SiteValidatePassword.cls
Created March 8, 2016 05:17
Site.validatePasswordの実行サンプル
User loginUser = [SELECT Id,Username,FirstName,LastName FROM User WHERE Id =: UserInfo.getUserId() LIMIT 1];
Site.validatePassword(loginUser, this.newPassword, this.verifyNewPassword);