Skip to content

Instantly share code, notes, and snippets.

Avatar
👩‍💻

Shruti Sridharan shrutis22

👩‍💻
View GitHub Profile
@shrutis22
shrutis22 / startGame.js
Created Jan 15, 2016
Start Game - Brick Game
View startGame.js
function startCollisionChecker() {
intervalId = setInterval(checkCollision, 100);
}
function reset() {
parseInt(jQuery("#points").html("-1"));
}
function startGame() {
$("#start").hide();
@shrutis22
shrutis22 / newCaseNotifierTrigger.java
Created Mar 3, 2016
Trigger which calls HipChat Notify Class
View newCaseNotifierTrigger.java
/**
* Trigger to display a message
* in HipChat when a new Case is
* created.
*
* @author Shruti Sridharan
* @since 23/02/2016
* @version 1.0
*/
trigger newCaseNotifierTrigger on Case ( after insert ) {
@shrutis22
shrutis22 / HipChatNotifier.java
Created Mar 3, 2016
Class which makes API Calls to HipChat Servers
View HipChatNotifier.java
/**
* This class exposes a method
* to send a message to Hip Chat in a
* specific Room named Hip Chat
* API Exploration.
*
* @author Shruti Sridharan
* @since 23/02/2016
* @version 1.0
*/
View TesselServices.cls
@RestResource( urlMapping = '/tesselservices/*' )
global class TesselServices {
public static final String MODEL_ID = 'INSERT MODEL ID HERE';
@HttpPost
global static String upload() {
RestRequest req = RestContext.request;
RestResponse res = Restcontext.response;
Blob picture = req.requestBody;
View LightningLookup.cmp
<aura:component implements="lightning:availableForFlowScreens,flexipage:availableForRecordHome,force:hasRecordId" access="global">
<aura:attribute name="objectApiName" type="String" access="public" />
<aura:attribute name="fieldLabel" type="String" access="public" />
<aura:attribute name="fieldName" type="String" access="public" />
<aura:attribute name="selectedRecordId" type="String" access="public" />
<lightning:recordEditForm objectApiName="{!v.objectApiName}">
<label class="fieldLabel">{!v.fieldLabel}</label>
<lightning:inputField fieldName="{!v.fieldName}" onchange="{!c.handleOnChange}" />
</lightning:recordEditForm>
View LightningLookup.css
.THIS label.slds-form-element__label {
display: none;
}
.THIS .fieldLabel {
font-size: .75rem;
}
View LightningLookup.design
<design:component>
<design:attribute name="objectApiName" />
<design:attribute name="fieldLabel" />
<design:attribute name="fieldName" />
<design:attribute name="selectedRecordId" />
</design:component>
View LightningLookupController.js
({
handleOnChange : function(component, event, helper) {
component.set( "v.selectedRecordId", event.getParams( "fields" ).value );
}
})
View ShowEmotionsHelper.js
({
getGiphyImage : function( emotion, callback ) {
var xhr = new XMLHttpRequest();
xhr.open( "GET", "https://api.giphy.com/v1/gifs/search?api_key=B9pfrx9wtMXmdLnVaJ6vllAW7uTqaHvO&q=" + emotion + "&limit=1", false )
xhr.onreadystatechange = function() {
if( this.readyState === 4 ) {
var jsonResp = JSON.parse( this.response );
var gifUrl = jsonResp.data[0].images.downsized.url;
View ShowEmotionsController.js
({
showEmotion : function(component, event, helper) {
var toneAnalyzeResponse = component.get( "v.toneAnalyzeResponse" );
var standardTones = [ "joy", "sadness", "anger", "fear" ];
var emotion;
for( var i = 0; i <= standardTones.length - 1; i++ ) {
if( toneAnalyzeResponse.indexOf( standardTones[i] ) !== -1 ) {
emotion = standardTones[i];