Skip to content

Instantly share code, notes, and snippets.

<!-- 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>
@calvinnr7
calvinnr7 / gist:96c690101fe4e22f50ed
Created May 30, 2015 19:43
"FizzBuzz" program in Javascript (prints 1-20)
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");
}
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
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;}
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);
<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">
({
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")
},
({
//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");
<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>