This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foldl (\acc x -> acc + x) 0 [1,2,3,4] | |
-- acc starts at 0, x starts as the first element of the list, so 1 | |
-- 0 + 1 = 1 -> acc = 1, list = [2,3,4] | |
-- 1 + 2 = 3 -> acc = 3, list = [3,4] | |
-- 3 + 3 = 6 -> acc = 6, list = [4] | |
-- 6 + 4 = 10 -> acc = 10 | |
-- therefore, this foldl results in a value of 10 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
countingDNANucleotides = foldl (\(a,c,g,t) x -> if x == 'A' then (a+1,c,g,t) else if x == 'C' then (a,c+1,g,t) else if x == 'G' then (a,c,g+1,t) else if x == 'T' then (a,c,g,t+1) else (a,c,g,t)) (0,0,0,0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum PowerUp { | |
case None | |
case Scoring (Int) | |
case Velocity (Int) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public with sharing class DataWrapper { | |
public Object value { get; set; } | |
public DataWrapper() {} | |
public DataWrapper(Object theValue) { | |
value = theValue; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:component> | |
<apex:stylesheet value="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" /> | |
<apex:includeScript value="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js" /> | |
<apex:includeScript value="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js" /> | |
<style type="text/css"> | |
#sidebarDiv { | |
background: crimson; | |
} | |
</style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:page standardController="Account" showHeader="true" sidebar="true"> | |
<c:CaseCommentsComponent accountId="{!account.Id}" /> | |
</apex:page> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:component controller="CaseCommentsComponentController" selfClosing="true"> | |
<apex:attribute name="accountId" description="The ID of the Account to reference" type="Id" required="false" assignTo="{!theAccountId}"></apex:attribute> | |
<apex:pageBlock> | |
<apex:pageBlockSection> | |
<apex:pageBlockTable value="{!comments}" var="c"> | |
<apex:column value="{!c.Parent.CaseNumber}" /> | |
<apex:column value="{!c.Parent.Subject}" /> | |
<apex:column value="{!c.CommentBody}" /> | |
</apex:pageBlockTable> | |
</apex:pageBlockSection> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:page standardController="Account" extensions="AccountCaseCommentsExtension" showHeader="true" sidebar="true"> | |
<apex:pageBlock> | |
<apex:pageBlockSection> | |
<apex:pageBlockTable value="{!account.Cases}" var="c"> | |
<apex:column value="{!c.CaseNumber}" /> | |
<apex:column value="{!c.Subject}" /> | |
<apex:column value="{!caseToCaseComment[c.Id].CommentBody}" /> | |
</apex:pageBlockTable> | |
</apex:pageBlockSection> | |
</apex:pageBlock> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Present the view controller using the popover style. | |
myPopoverViewController.modalPresentationStyle = UIModalPresentationPopover; | |
[self presentViewController:myPopoverViewController animated: YES completion: nil]; | |
// Get the popover presentation controller and configure it. | |
UIPopoverPresentationController *presentationController = [myPopoverViewController popoverPresentationController]; | |
presentationController.permittedArrowDirections = UIPopoverArrowDirectionLeft | UIPopoverArrowDirectionRight; | |
presentationController.sourceView = myView; | |
presentationController.sourceRect = sourceRect; |