Skip to content

Instantly share code, notes, and snippets.

View jsmithdev's full-sized avatar
🏗️
building things

Jamie Smith jsmithdev

🏗️
building things
View GitHub Profile
<html>
<head>
<title>API Example</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
var accessToken = "<your agent's client access token>";
var baseUrl = "https://api.api.ai/v1/";
@jsmithdev
jsmithdev / firebase_detect_data.js
Created April 14, 2017 14:30 — forked from anantn/firebase_detect_data.js
Firebase: Detecting if data exists. This snippet detects if a user ID is already taken
function go() {
var userId = prompt('Username?', 'Guest');
checkIfUserExists(userId);
}
var USERS_LOCATION = 'https://SampleChat.firebaseIO-demo.com/users';
function userExistsCallback(userId, exists) {
if (exists) {
alert('user ' + userId + ' exists!');
@jsmithdev
jsmithdev / fiddle.html
Created March 11, 2018 05:00 — forked from anonymous/fiddle.html
Modern WebRTC remote call w/chat (source: https://jsfiddle.net/jamiesmith/Lcpk143y/)
<video id="video1" height="120" width="160" autoplay muted></video>
<video id="video2" height="120" width="160" autoplay></video>
<br>
<button id="button" onclick="createOffer()">Offer:</button>
<textarea id="offer" placeholder="Paste offer here"></textarea>
<br>
@jsmithdev
jsmithdev / Simple Node Gulpfile.js
Last active December 13, 2018 01:18 — forked from webdesserts/Gulpfile.js
Revised for Gulp v4: Automatically reload your node.js app on file change with Gulp (https://github.com/wearefractal/gulp).
// jshint esversion: 6, asi: true, laxcomma: true
const gulp = require('gulp')
, spawn = require('child_process').spawn
, killer = node => node ? node.kill() : null
, config = {
init: ['index.js'],
watch: ['*.js']
}
;
@jsmithdev
jsmithdev / sfdx-cheatsheet.sh
Created February 22, 2019 19:54 — forked from xixiaofinland/sfdx-cheatsheet.sh
Salesforce SFDX Cheat Sheet
# This cheatsheet contains the most often used SFDX commands for beginners to get a jumpstart.
# Hint. it is highly recommended to use `-h` to check the usage of any SFDX commands and corresponding parameters.
# For instance, use `sfdx force:auth:web:login -h` to checke what `-d` `-a` parameters do
# List down all supported dx commands:
sfdx force:doc:commands:list
# Check current DebHub and Scratch Org status
sfdx force:org:list
@jsmithdev
jsmithdev / generatepkgXML.sh
Created April 4, 2019 22:14 — forked from msrivastav13/generatepkgXML.sh
Generates package.xml from the Unmanaged container/Managed Package or Changesets
#!/bin/bash
if [ $# -lt 1 ]
then
echo Usage: generatepkgXML.sh orgalias packageName
exit
fi
## Retrieve the PackageXML from Unmanaged Container
import { LightningElement } from 'lwc';
import moment from '@salesforce/resourceUrl/moment';
import { loadScript } from 'lightning/platformResourceLoader';
export default class MomentStuffs extends LightningElement {
renderedCallback(){
Promise.all([
loadScript(this, moment + '/moment.js')
]).then(() => {
@jsmithdev
jsmithdev / ContentDocumentTest.java
Created June 7, 2019 03:02 — forked from xgeek-net/ContentDocumentTest.java
ContentDocumentTest Apex TestClass
@isTest
private class ContentDocumentTest {
private static testMethod void testCreate() {
ContentVersion contentVersion_1 = new ContentVersion(
Title = 'Penguins',
PathOnClient = 'Penguins.jpg',
VersionData = Blob.valueOf('Test Content')
IsMajorVersion = true
);
insert contentVersion_1;
@jsmithdev
jsmithdev / AWS.cls
Created May 17, 2020 01:26 — forked from brianmfear/AWS.cls
Abstract AWS implementation in Apex Code
/*
// Example implementation as follows:
public class AWSS3_GetService extends AWS {
public override void init() {
endpoint = new Url('https://s3.amazonaws.com/');
resource = '/';
region = 'us-east-1';
service = 's3';
accessKey = 'my-key-here';
method = HttpMethod.XGET;
@jsmithdev
jsmithdev / delay.js
Created June 20, 2020 00:21 — forked from eteeselink/delay.js
ES7 async/await version of setTimeout
const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
async function something() {
console.log("this might take some time....");
await delay(5000);
console.log("done!")
}
something();