Skip to content

Instantly share code, notes, and snippets.

View tigarcia's full-sized avatar

Tim Garcia tigarcia

View GitHub Profile
// npm install --save twitter dotenv sentiment
require('dotenv').config();
const Twitter = require('twitter');
const sentiment = require('sentiment');
const rpio = require('rpio');
const Promise = require('bluebird');
function delay(ms) {
var deferred = Promise.pending();
@tigarcia
tigarcia / raspberry_pi.js
Last active March 2, 2017 20:38
workshop demo of raspberry pi and node js
import RPi.GPIO as GPIO
import time
led = 11
GPIO.setmode(GPIO.BOARD)
GPIO.setup(led, GPIO.OUT)
GPIO.output(led, GPIO.HIGH)
time.sleep(2)
@tigarcia
tigarcia / tetris-oop.md
Created December 14, 2016 01:07
OOP Tetris Outline

Tetris

The goal of the application is to create a javascript version of tetris that uses object oriented programming to solve the problem.

Requirements

As a user, I should be able to:

  • Start the game
  • get a random falling shape every x seconds
@tigarcia
tigarcia / oop.md
Last active November 9, 2023 01:27
Notes on oop design

Object Oriented Programming

Objectives

After this lesson you should be able to:

  • Describe the 4 pillars of OOP (abstraction, encapsulation, inheritance, polymorphism)
  • Name a few popular OOP design patterns
  • Gather requirements for an OOP problem
@tigarcia
tigarcia / linux_on_windows_with_virtualbox.md
Last active September 20, 2016 19:41
How to setup a linux virtual machine on a windows computer using virtual box

Installing Linux on Windows

Most web developer work exclusively in a linux like environment (don't worry mac users, macOS is very similar to linux under the covers). If you have a Windows machine and want to do web development, the easiest way to get started is to install linux on your computer. We will do the install using a virtual machine called VirtualBox and a linux distribution called Ubuntu.

  1. Download and install Virtualbox
  2. Download Ubuntu Linux, but do not try to install it. Just take note of where you downloaded the .iso file.
  3. Open up virutal box and click the new button.
  4. Name the virtual machine anything you like (maybe Ubuntu). Make sure the type is linux and the version is Ubuntu 64-bit.
  5. Click continue/create for the next couple of screens. You do not need to change any of the default settings

#Javascript Basics: Arrays And Objects

Objective

Be able to access and create complex objects. For example

var players = [
    {name: 'Curry', number: '30', position: 'point guard'},
 {name: 'Thompson', number: '11', position: 'shooting guard'},
@tigarcia
tigarcia / JavascriptBasics.md
Last active August 29, 2015 14:20
Javascript Basics: Conditionals, Switch Statements, Loops

Javascript Basics: Conditionals, Switch Statements, Loops

Objective

Learn and be able to apply conditionals, loops, and switch statements to problem solving. Learning the syntax will be the first step, but once you've got that down, focus on problem solving.

Conditionals

Conditionals control the flow of a program. Conditionals decide which code statements gets run based on some input to the conditional. An example from everyday life would be:

@tigarcia
tigarcia / common_characters.md
Created June 10, 2014 17:58
Common Letters in 2 Strings

Common Characters Interview Questions

Write a function that takes two strings as arguments and returns a string containing only the characters found in both strings. Write 2 versions – one that is O(n) and one that is O(n^2).

O(n^2) Solution

def common_characters_O_of_N2(string1, string2)
 common = {}