Skip to content

Instantly share code, notes, and snippets.

View xjsender's full-sized avatar
🎯
Focusing

Hao Liu xjsender

🎯
Focusing
View GitHub Profile
@xjsender
xjsender / Export File Name with Chinese.md
Last active March 15, 2018 08:21
Export File Name with Chinese
public String getFileName() {
    String fileName = '标准公有云及混托产品报价单';
    return EncodingUtil.urlEncode(fileName, 'utf-8') + '.xls';
}
contentType="txt/xml#{!fileName}"
@xjsender
xjsender / Create Picklist Dependency by APEX.cls
Last active July 19, 2022 13:16
Create Picklist Dependency by APEX
public with sharing class UpdatePicklistDependency {
// A1 is the dependent value, A is the controlling value
// which means A1 is controller by A, 1 => Many
private static Map<String, List<String>> relationships = new Map<String, List<String>> {
'A1' => new List<String>{'A'},
'A2' => new List<String>{'A'},
'B1' => new List<String>{'B'},
'B2' => new List<String>{'B'},
'C1' => new List<String>{'C'},
'C2' => new List<String>{'C'},
@xjsender
xjsender / Find Missed Tags.py
Last active May 3, 2020 13:14
Read JSON from Lightning compnent
tags = [
"aura:expression",
"aura:html",
"aura:if",
"aura:iteration",
"aura:renderIf",
"aura:template",
"aura:text",
"aura:unescapedHtml",
"auraStorage:init",
@xjsender
xjsender / User Problem.java
Created September 19, 2017 03:31
User Problem
List<Contact> cons = [
SELECT Id, Name FROM Contact
WHERE Role_Id__c != null
AND Is_Active__c = true
AND Email != null
];
List<User> users = [
SELECT Id, ContactId FROM User WHERE ContactId IN :cons
];
@xjsender
xjsender / baidu-map-quick-custom-overlay.html
Created May 9, 2016 14:10 — forked from ufologist/baidu-map-quick-custom-overlay.html
百度地图 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 {
@xjsender
xjsender / Get Selected Ids in the List Button.js
Created August 12, 2015 02:42
Get Selected Ids in the List Button
idElements = document.getElementsByName('ids');
ids = new Array();
for (i = 0; i < idElements.length; i++) {
ele = idElements[i];
if (ele.checked) {
ids.push(ele.value);
}
}
console.log(ids);
@xjsender
xjsender / multiple_ssh_setting.md
Last active August 29, 2015 14:27 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@xjsender
xjsender / Bootstrap3 Progress-bar.css
Created July 27, 2015 02:45
Bootstrap3 Progress-bar
/* boostrap progressbar */
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0,0,0,0);
@xjsender
xjsender / Visualforce PDF Landscape.md
Last active December 24, 2015 10:06
Visualforce PDF Landscape

Add page size for PDF rotation below v28.0

@page {
    size: landscape;
}

After v28.0, use below method:

<!--
We will create a family tree using just CSS(3)
The markup will be simple nested lists
-->
<style>
/*Now the CSS*/
* {margin: 0; padding: 0;}
.tree ul {
padding-top: 20px; position: relative;