Skip to content

Instantly share code, notes, and snippets.

View xjsender's full-sized avatar
🎯
Focusing

Hao Liu xjsender

🎯
Focusing
View GitHub Profile
@floriankraft
floriankraft / ajax-with-promise.ts
Created January 15, 2017 11:33
HTTP Request with Promises in Typescript
getRequest(url: string): Promise<any> {
return new Promise<any>(
function (resolve, reject) {
const request = new XMLHttpRequest();
request.onload = function () {
if (this.status === 200) {
resolve(this.response);
} else {
reject(new Error(this.statusText));
}
@peterknolle
peterknolle / remoteObjectNodes.page
Last active August 7, 2018 09:07
Visualforce Remote Objects and jsTree jQuery plugin
<apex:page >
<!-- download the jstree from jstree.com and upload the dist directory as a static resource -->
<link href="{!URLFOR($Resource.jsTree, 'themes/default/style.min.css')}" rel="stylesheet" />
<script src="{!URLFOR($Resource.jsTree, 'libs/jquery.js')}"></script>
<script src="{!URLFOR($Resource.jsTree, 'jstree.min.js')}"></script>
<script src="{!URLFOR($Resource.jsTree, 'jstree.min.js')}"></script>
<!--
Change the remoteObjectModel name="Account and
@ufologist
ufologist / baidu-map-quick-custom-overlay.html
Created March 3, 2014 14:59
百度地图 JavaScript API 极速版自定义覆盖物
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>百度地图 JavaScript API 极速版自定义覆盖物</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no" />
<style>
body,
html,
#mapdemo {
@yellis
yellis / gist:8955467
Last active February 11, 2019 22:51
Convert 15 Char Salesforce Id to 18 Char Salesforce Id
// Based on algorithm given at http://wp.me/pWWz3-14
static string Convert15CharTo18CharId(string id)
{
if (string.IsNullOrEmpty(id)) throw new ArgumentNullException("id");
if (id.Length == 18) return id;
if (id.Length != 15) throw new ArgumentException("Illegal argument length. 15 char string expected.", "id");
var triplet = new List<string> {id.Substring(0, 5), id.Substring(5, 5), id.Substring(10, 5)};
StringBuilder str = new StringBuilder(5);
string suffix = string.Empty;
@btoone
btoone / curl.md
Last active August 8, 2026 21:47
A curl tutorial using GitHub's API

Introduction

An introduction to curl using GitHub's API.

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin
@pontikis
pontikis / .gitingore
Created July 21, 2011 16:28
jsTree in a nutshell
# /.idea
/.idea/*