Skip to content

Instantly share code, notes, and snippets.

View shrutis22's full-sized avatar
👩‍💻

Shruti Sridharan shrutis22

👩‍💻
View GitHub Profile
@shrutis22
shrutis22 / startGame.js
Created January 15, 2016 07:21
Start Game - Brick Game
function startCollisionChecker() {
intervalId = setInterval(checkCollision, 100);
}
function reset() {
parseInt(jQuery("#points").html("-1"));
}
function startGame() {
$("#start").hide();
@shrutis22
shrutis22 / newCaseNotifierTrigger.java
Created March 3, 2016 08:32
Trigger which calls HipChat Notify Class
/**
* 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 March 3, 2016 09:19
Class which makes API Calls to HipChat Servers
/**
* 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
*/
@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;
<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>
.THIS label.slds-form-element__label {
display: none;
}
.THIS .fieldLabel {
font-size: .75rem;
}
<design:component>
<design:attribute name="objectApiName" />
<design:attribute name="fieldLabel" />
<design:attribute name="fieldName" />
<design:attribute name="selectedRecordId" />
</design:component>
({
handleOnChange : function(component, event, helper) {
component.set( "v.selectedRecordId", event.getParams( "fields" ).value );
}
})
({
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;
({
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];