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
@jsmithdev
jsmithdev / designer.html
Created February 6, 2015 07:14
designer
<link rel="import" href="../core-animated-pages/core-animated-pages.html">
<link rel="import" href="../core-animated-pages/transitions/hero-transition.html">
<link rel="import" href="../core-animated-pages/transitions/cross-fade.html">
<link rel="import" href="../core-animated-pages/transitions/slide-down.html">
<link rel="import" href="../core-animated-pages/transitions/slide-up.html">
<link rel="import" href="../core-animated-pages/transitions/tile-cascade.html">
<polymer-element name="my-element">
<template>
<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 / ExampleDmlAsap.cls
Created December 9, 2016 15:42
EXAMPLE ONLY: DML on load of VF page, which technically you're not supposed to do but that makes it fun... More @ https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_page.htm
/* ' ### You'll need something like this in your visual force page, main focus being action="{!markActiveDetails}" ###
' <apex:page docType="html-5.0" action="{!markActiveDetails}" standardController="Service_Inquiry_SP__c" recordSetVar="sit" extensions="ServiceInquiryOSPExt" standardStylesheets="false" sidebar="false">
' </apex:page>
*/
public PageReference markActiveDetails(){
System.debug('#$#$# markActiveDetails running with siId ' + siId);
List<Service_Inquiry_Details__c> deetsToUpdate = new List<Service_Inquiry_Details__c>();
//##### BEFORE #####
({
openAttach : function(component, event, helper) {
var getUrlParameter = window.location.href;
var urlParts = getUrlParameter.split("/s/");
console.log('aaa')+urlParts[0];
var x =component.get("v.Atts");
console.log(x[0][0]);
//alert(urlParts[0]);
//var tempId = urlParts[1];
// LIVE @ https://jsfiddle.net/jamiesmith/q8aw51ry/
Date.prototype.today = function () {
return ((this.getDate() < 10)?"0":"") + this.getDate() +"/"+(((this.getMonth()+1) < 10)?"0":"") + (this.getMonth()+1) +"/"+ this.getFullYear();
}
Date.prototype.timeNow = function () {
return ((this.getHours() < 10)?"0":"") + this.getHours() +":"+ ((this.getMinutes() < 10)?"0":"") + this.getMinutes()
//+":"+ ((this.getSeconds() < 10)?"0":"") + this.getSeconds();
}
$('body').on('click', 'button#sitpr', function() {
let sessionId = $.urlParam('SessionId');
let serverUrl = $.urlParam('ServerUrl');
let siId15 = '{!si.Id}'.substring(0,15);
let masterId15 = '{!congaMasterTemp}'.substring(0,15);
let techId15 = '{!congaTechPrint}'.substring(0,15);
let costId15 = '{!congaCostId}'.substring(0,15);
let detailActive = '{!siDetail.Active__c}'.substring(0,15);
@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!');
'use strict'
const port = process.env.PORT || 8080
const request = require('request')
//Be sure to change YOURAPPNAME
let keywordUrl = "http://svcs.ebay.com/services/search/FindingService/v1";
keywordUrl += "?OPERATION-NAME=findItemsByKeywords";
keywordUrl += "&SERVICE-VERSION=1.0.0";
keywordUrl += "&SECURITY-APPNAME=YOURAPPNAME";
keywordUrl += "&GLOBAL-ID=EBAY-US";
@jsmithdev
jsmithdev / sync-firebase-gulpfile.js
Created May 22, 2017 01:07
Sync a Firebase App + Functions with Gulp automatically.
'use strict';
const gulp = require('gulp')
,watch = require('gulp-watch')
,dir = '/home/ubuntu/workspace/app'
,fnDir = '/home/ubuntu/workspace/functions'
,version = 'prod'
,useVersion = false
,comando = "firebase deploy "
,comandoParams = " -P " +version+ " "
,comandOnlyFnc = " --only functions "
@jsmithdev
jsmithdev / pageBlockConverted.page
Created September 21, 2017 15:41
VF page that has been converted to a more standard web format conducive to lightning. Get wrapped SLDS here: https://tools.lightningdesignsystem.com/css-customizer
<apex:page standardController="Program__c" extensions="commProgramExt" showHeader="true" standardStylesheets="false">
<head>
<apex:stylesheet value="{!URLFOR($Resource.sldsScoped, 'assets/styles/salesforce-lightning-design-system-vf.min.css')}" />
<style>
html {
width: 98%;