Skip to content

Instantly share code, notes, and snippets.

View k-usk's full-sized avatar

Yusuke Kano k-usk

View GitHub Profile
@k-usk
k-usk / BrakenController.php
Created June 4, 2018 03:37
Laravelでの{{}}で囲った文字列の出力テスト
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class BrokenController extends Controller
{
public function index()
{
@k-usk
k-usk / getRecordTypeByObjectName
Last active December 16, 2016 09:26
指定されたオブジェクトのレコードタイプを全て取得する
/**
* 指定されたオブジェクトのレコードタイプを全て取得する
*
* @param String objName オブジェクト名
* @return Schema.RecordTypeInfo レコードタイプ一覧
*/
public List<Schema.RecordTypeInfo> getRecordTypeByObjectName(String objName) {
List<Schema.RecordTypeInfo> recordTypes;
Schema.SObjectType sType = (Schema.SObjectType)Schema.getGlobalDescribe().get(objName);
if(sType != null){
@k-usk
k-usk / OAuth.cls
Last active June 30, 2016 07:18 — forked from surjikal/OAuth.cls
Apex 2-legged OAuth 1.0
public class OAuth {
public static HttpRequest signRequest(HttpRequest req, String consumerKey, String consumerSecret, String oauth_token, String oauth_token_secret) {
String nonce = String.valueOf(Crypto.getRandomLong());
String timestamp = String.valueOf(DateTime.now().getTime() / 1000);
Map<String,String> parameters = new Map<String,String>();
parameters.put('oauth_signature_method','HMAC-SHA1');
parameters.put('oauth_consumer_key', consumerKey);
parameters.put('oauth_timestamp', timestamp);
@k-usk
k-usk / cant-doubleclick.html
Created April 28, 2016 06:45
jQueryによる二度押し防止
<form action="xxx.php" method="post" id="send-form">
<input name="submit" type="submit" value="送信" />
</form>
<script type="text/javascript">
var submit_flg = false;
$('#send-form').submit(function(){
if(submit_flg) return false;
submit_flg = true;
});
@RestResource(urlMapping='/insert/example')
global with sharing class Insert_example {
@HttpPost
global static CustomObject doPost(){
RestRequest req = RestContext.request;
Map<String, String> params = req.params;
CustomObject obj = new CustomObject(); //カスタムを作成
@k-usk
k-usk / API_Utils.cls
Last active February 16, 2016 07:28
Apex Utility
public class API_Utils {
/**
* 全ての項目を取得するSOQLを作る
* 例)
* String all_string = getAllItem('Campaign');
* String query = 'SELECT ' + all_string + ' FROM Campaign';
*
* @param String sObjName オブジェクト名
* @return String カンマ区切りの全項目
*/
@k-usk
k-usk / Procfile
Created November 13, 2015 02:01
Procfile for heroku
web: vendor/bin/heroku-php-apache2 htdocs/
@k-usk
k-usk / composer
Created November 13, 2015 02:00
composer for heroku
{
"require": {
"php": "~5.6.0",
"ext-mbstring": "*"
}
}
root = true
[*]
end_of_line = lf
charset = utf-8
indent_style = tab
indent_size = 4
trim_trailing_whitespace = false
insert_final_newline = false