Skip to content

Instantly share code, notes, and snippets.

<apex:page docType="html-5.0" sidebar="false" showHeader="false"
standardStylesheets="false" cache="true">
<html lang="en">
<head>
<meta charset="utf-8"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script type="text/javascript">
var SESSION_ID = '{!$Api.Session_ID}';
var SERVER_URL = '{! 'https://'+
<apex:page docType="html-5.0" sidebar="false" showHeader="false"
standardStylesheets="false" cache="true">
<html lang="en">
<head>
<meta charset="utf-8"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script type="text/javascript">
var SESSION_ID = '{!$Api.Session_ID}';
var serverURL = '{!SUBSTITUTE(SUBSTITUTE(LEFT($Api.Partner_Server_URL_210, FIND( '/services', $Api.Partner_Server_URL_260)), 'visual.force', 'salesforce'), 'c.', '')}';
<apex:page controller="CustomerCommunityController" id="customercommunitycontroller" sidebar="false" showHeader="false" standardStylesheets="false" >
<head>
<title>Acme Customer Support</title>
<meta charset="utf-8" />
<apex:includeScript value="{!$Resource.jquery}"/>
</head>
<script type="text/javascript">
authorization: OAuth 00DU0000000J83v!AQoAQJkLzYuCPmfyTZ7Mmg.Otq3W6klMTqqXUsTUdfwMtk8BcZJxpNdyCfUmm5.0Psfr8j7xDoNnRuV8u7UtANm.E_ubaXCB
x-chatter-entity-encoding: false
accept: */*
user-agent: Ruby
content-type: multipart/form-data; boundary=-----------RubyMultipartPost
content-length: 34684
-------------RubyMultipartPost
Content-Disposition: form-data; name="json"
Content-Type: application/json; charset=UTF-8
Content-Transfer-Encoding: 8bit
{
"instance_url": "https://na12.salesforce.com",
"items": [{
"parent": {
"name": "John Smith",
"title": null,
"firstName": "John",
"lastName": "Smith",
"companyName": "No company locations found",
"mySubscription": null,
# helper that takes a feedItem hash and converts it to HTML, including
# properly structuring any included message segments like @mentions.
def message_segments(msg_segments)
# an array of hashes - each hash a segment
html = ''
msg_segments.each do |segment|
html << case segment['type']
when 'Text'
segment['text']
# search for feed items that match text and are parented by record_id,
# e.g. a specific group or record feed. page_size must be a number between
# 1 and 100. This method doesn't handle paging, so in most cases you'll want to also
# add a page parameter to the query and continue to page even though no posts appear
# for the searched group in some pages.
def self.search_feed(user, record_id, text, page_size=100)
escaped_text = URI.escape(text, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
items = Session.do_get(user, "/chatter/feed-items?q=#{escaped_text}&pageSize=#{page_size}")
# filter out items that are not part of the searched group
output = []
@piyushrajput
piyushrajput / ChangePassword.java
Created October 19, 2015 07:35 — forked from zach-klippenstein/ChangePassword.java
The keystore password on Java keystore files is utterly pointless. You can reset it without knowing it, as shown by this code. Note that private keys are still secure, as far as I know. The JKS implementation is copyright Casey Marshall ([email protected]), and the original source is available at http://metastatic.org/source/JKS.java. I've in…
import java.util.*;
import java.io.*;
import java.security.*;
public class ChangePassword
{
private final static JKS j = new JKS();
public static void main(String[] args) throws Exception
{
@piyushrajput
piyushrajput / open-dev-console-in-new-window.js
Created October 27, 2015 11:08
Change the dev console link to open in new tab
x = document.getElementsByClassName("debugLogLink");
y = decodeURIComponent(x[0].getAttribute("href"));
z = y.substring(y.indexOf("'")+1);
p = z.substring(0,z.indexOf("'"));
x[0].setAttribute("href",p);
x[0].setAttribute("target","_blank");
@piyushrajput
piyushrajput / swap.sh
Created November 20, 2015 05:22 — forked from peterchester/swap.sh
A simple little shell script that executes the digital ocean swap file tutorial.
#/bin/sh
# Creates a 1gb swap image.
# @see https://www.digitalocean.com/community/tutorials/how-to-configure-virtual-memory-swap-file-on-a-vps
if [ -f /var/swap.img ]; then
echo "Swap file already exists."
else
touch /var/swap.img
chmod 600 /var/swap.img