Skip to content

Instantly share code, notes, and snippets.

View sbaldwin24's full-sized avatar
🇺🇸

Sterling Baldwin sbaldwin24

🇺🇸
View GitHub Profile
@sbaldwin24
sbaldwin24 / data.json
Last active November 11, 2023 20:56
Countries
{
"AF": "Afghanistan",
"AL": "Albania",
"DZ": "Algeria",
"AS": "American Samoa",
"AD": "Andorra",
"AO": "Angola",
"AI": "Anguilla",
"AQ": "Antarctica",
"AG": "Antigua and Barbuda",

Keybase proof

I hereby claim:

  • I am sbaldwin24 on github.
  • I am sbaldwin24 (https://keybase.io/sbaldwin24) on keybase.
  • I have a public key ASDGrEO-83MV9d-_IaY17OOzDCQcybE5qgttAR4rXrdNBwo

To claim this, I am signing this object:

<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../topeka-elements/category-images.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-icons/av-icons.html">
<link rel="import" href="../paper-fab/paper-fab.html">
<polymer-element name="my-element">
<link rel="import" href="../ace-element/ace-element.html">
<link rel="import" href="../speech-mic/speech-mic.html">
<link rel="import" href="../topeka-elements/category-icons.html">
<link rel="import" href="../core-icon/core-icon.html">
<polymer-element name="my-element">
<template>
<style>
:host {
@sbaldwin24
sbaldwin24 / gist:2063befa0183411a4b50
Created November 8, 2014 20:30
Python Boolean Operators
"""
Boolean Operators
------------------------ True and True is True
True and False is False
False and True is False
False and False is False
True or True is True
True or False is True
False or True is True
@sbaldwin24
sbaldwin24 / Models-Backbone.md
Created October 5, 2014 19:14
Models in Backbone

Models in Backbone

A model contains the state (i.e. the JSON data or what Backbone calls attributes) for an application, as well as a basic set of functionality (i.e. methods like .set() or .get() and events like change) for managing and listening to changes in the state/data.

Additionally, the model orchestrates the storing of this state/data in memory in the browser, as well as persisting the state/data to the database on the server (i.e. syncing).

Collections

An ordered grouping of models is a collection.

In Backbone, collections are wrapped with a basic set of functionality for working with groups of models. The classic illustration of a model would be the data for a to-do item (i.e. the to-do and its state of completion), and a list of to-dos would be considered a collection of to-do models.

@sbaldwin24
sbaldwin24 / Statements.md
Last active August 29, 2015 14:07
Statements

Statemenets

When used inside of a function, the var statement defines the function's private variables. Statements tend to be executed in order from top to bottom. The sequence of execution can alttered by Conditional, Looping, and Distruptive Statements.

Coniditional Statements

if and switch

Looping Statements

while, for, and do

Disruptive Statements

@sbaldwin24
sbaldwin24 / gist:a6500a5d4711795a8fbc
Created September 20, 2014 17:10
UnderscoreJS Demo Template
<!DOCTYPE html>
<html lang="en">
<head>
<title>User Profile Page</title>
<meta charset="utf-8">
<script src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.3.3/underscore-min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.0/jquery-1.8.0.min.js "></script>
<script>
window.onload = initPage;
function initPage() {
@sbaldwin24
sbaldwin24 / 99 Bottles of Beer with Underscore
Created September 16, 2014 08:42
99 Bottles of Beer with Underscore
This imperative version, while somewhat contrived, is emblematic of an imperative
programming style. That is, the implementation describes a “99 Bottles of Beer” pro‐
gram and exactly a “99 Bottles of Beer” program. Because imperative code operates at
such a precise level of detail, they are often one-shot implementations or at best, difficult
to reuse. Further, imperative languages are often restricted to a level of detail that is good
for their compilers rather than for their programmers (Sokolowski 1991).
By comparison, a more functional approach to this same problem might look as follows:
function lyricSegment(n) {
return _.chain([])
.push(n + " bottles of beer on the wall")
@sbaldwin24
sbaldwin24 / Imperative programming
Last active August 29, 2015 14:06
Imperative programming
Imperative programming
An imperative programming style is categorized by its exquisite (and often infuriating)
attention to the details of algorithm implementation. Further, imperative programs are
often built around the direct manipulation and inspection of program state. For exam‐
ple, imagine that you’d like to write a program to build a lyric sheet for the song “99
Bottles of Beer.” The most direct way to describe the requirements of this program are
as such:
• Start at 99
• Sing the following for each number down to 1:
— X bottles of beer on the wall