Skip to content

Instantly share code, notes, and snippets.

View owenso's full-sized avatar

Owens O'Brien owenso

View GitHub Profile
@owenso
owenso / assessment.md
Last active August 29, 2015 14:22
week1 assessment

###Problem 1

pets[2];

###Problem 2

coolThings.pavan;

@owenso
owenso / cupcake.js
Last active August 29, 2015 14:23
WK 02 Assessment - Owens O'Brien
// Using a Constructor Function, create a Cupcake Constructor.
// Question 5 / 6 - Write your Cupcake Constructor Function here.
var Cupcake = function (cakeFlavor, frostingFlavor){
this.cake = cakeFlavor;
this.frostingFlavor = frostingFlavor;
this.sprinkles = false;
this.getCake = function (){
return this.cake;
@owenso
owenso / gist:eb037261ae7f72df9c3d
Last active August 29, 2015 14:24
Week 5 assessment
1.The advantages of using a database include Atomocity (modifications will either all take place or the whole thing will be canceled, which helps prevent corrupted data and conflicts from half executed code), Consistancy (which helps programs and other programmers access your data), Isolation (data is queued and is modified in order, which helps Atomocity), and Durability (that data will exist until deleted).
2.
3. A database schema is something which tells the database what sort of data to expect, and what type of data it will be.
4. The browser is sending a put request, with a path of "/orders/:id". The code is taking in an id number from the path and storing an "order" object (from inputs in the browser) in an array within the data.json with an index of that id number.
5. Create, Read, Update, Destroy. Our apps will be able to modify data in all four of those ways. For example, in SQL, Create = INSERT, Read = SELECT, Update = UPDATE, and Destroy = DELETE.
@owenso
owenso / roomieChooser.js
Created April 3, 2017 02:27
Roomie Chooser
const roomies = ["Yas", "Nate", "Owens"];
console.log("Roomies UNSORTED:", roomies);
const randomRoomies = roomies.sort(function(a, b) { return 0.5 - Math.random() });
console.log("Roomies RANDOMIZED:", randomRoomies);
console.log("Bottom bedroom:", Math.floor(Math.random() * randomRoomies.length));
public static void attemptToFindAccountIfNone(List<Case> TriggerNew){
Id recordTypeId = Schema.SObjectType.Case.getRecordTypeInfosByName().get('BCS Case').getRecordTypeId();
List<Case> casesToUpdate = new List<Case>();
List<String> emails = new List<String>();
Map<String, Case> casesByEmails = new Map<String,Case>();
for (Case cs: TriggerNew) {
//limit to BCS Cases (soon support cases), without associated Accounts, but with Web Emails
if(cs.RecordTypeId == recordTypeId && cs.AccountId == null && cs.SuppliedEmail !==null){
emails.add(cs.SuppliedEmail);