Skip to content

Instantly share code, notes, and snippets.

<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 />
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
showDetails: function(component, event, helper) {
//Get data via "data-data" attribute from button (button itself or icon's parentNode)
var url ="data-data") ||"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 class="slds-media__body">
View AsteroidsController.apxc
public class AsteroidsController {
//Aura enabled needs to be static
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
public String str_Asteroid_Name {get;set;}
public Double str_Magnitude {get;set;}
public String str_NASA_URL {get;set;}
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; //
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)
else if (i % 3 === 0)
View Google Map Demo
<!-- Author: Calvin Noronha-->
<!-- Date:May 1 2015-->
<apex:page standardController="Contact">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"></meta>
<meta charset="utf-8"></meta>
<title>Simple markers</title>