Skip to content

Instantly share code, notes, and snippets.

calvinnr7

Block or report user

Report or block calvinnr7

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View AsteroidWarningSystem.app
<aura:application >
<ltng:require styles="/resource/SLDS201/assets/styles/salesforce-lightning-design-system.css" />
<div class="slds" style="margin-top:10px;margin-left:10px;">
<c:AsteroidsList />
</div>
</aura:application>
View AsteroidsListHelper.js
({
//Fetch the asteroids from the Apex controller
getAsteroidList: function(component) {
var action = component.get("c.getAsteroids");
var fromDateInput = component.find("fromDate");
var fromDateValue = fromDateInput.get("v.value");
var toDateInput = component.find("toDate");
var toDateValue = toDateInput.get("v.value");
View AsteroidsListController.js
({
doInit: function(component, event, helper) {
//Fetch the asteroid list from the Apex controller
helper.getAsteroidList(component);
},
showDetails: function(component, event, helper) {
//Get data via "data-data" attribute from button (button itself or icon's parentNode)
var url = event.target.getAttribute("data-data") || event.target.parentNode.getAttribute("data-data")
},
View AsteroidsList.cmp
<aura:component controller="AsteroidsController" implements="forceCommunity:availableForAllPageTypes">
<ltng:require styles="/resource/SLDS201/assets/styles/salesforce-lightning-design-system.css" />
<aura:attribute name="asteroids" type="List" />
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<!-- Use the Apex model and controller to fetch server side data -->
<div class="slds-page-header" role="banner">
<div class="slds-media slds-media--center">
<div class="slds-media__figure">
</div>
<div class="slds-media__body">
View AsteroidsController.apxc
public class AsteroidsController {
//Aura enabled needs to be static
@AuraEnabled
public static List<AsteroidWrapper> getAsteroids(String fromDate, String toDate) {
DateTime startDate;
DateTime endDate;
List<AsteroidWrapper> asteroidList = new List<AsteroidWrapper>();
System.debug('***fromDate is: ' + fromDate);
System.debug('***toDate is: ' + toDate);
View AsteroidWrapper.apxc
public class AsteroidWrapper
{
@AuraEnabled
public String str_Asteroid_Name {get;set;}
@AuraEnabled
public Double str_Magnitude {get;set;}
@AuraEnabled
public String str_NASA_URL {get;set;}
@AuraEnabled
public Double str_Estimated_Diameter_Max_Kms {get;set;}
View AsteroidData.apxc
public class AsteroidData{
public cls_links links;
public String neo_reference_id; //3127391
public String name; //(2002 LY1)
public String nasa_jpl_url; //http://ssd.jpl.nasa.gov/sbdb.cgi?sstr=3127391
@calvinnr7
calvinnr7 / gist:96c690101fe4e22f50ed
Created May 30, 2015
"FizzBuzz" program in Javascript (prints 1-20)
View gist:96c690101fe4e22f50ed
for (var i=1;i<=20;i++)
{
if (i % 3 === 0 && i % 5 === 0)
{
console.log("FizzBuzz");
}
else if (i % 3 === 0)
{
console.log("Fizz");
}
View Google Map Demo
<!-- Author: Calvin Noronha-->
<!-- Date:May 1 2015-->
<apex:page standardController="Contact">
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"></meta>
<meta charset="utf-8"></meta>
<title>Simple markers</title>
<style>
You can’t perform that action at this time.