Skip to content

Instantly share code, notes, and snippets.

@efuquen
efuquen / mihs-functions.md
Last active August 29, 2015 14:13
MIHS Functions
@efuquen
efuquen / mihs-scripted-exit-2_10_2015.md
Last active August 29, 2015 14:15
MIHS ScriptEd Do Now for 2/10/2015

#MIHS ScriptEd Exit Ticket - 2/10/2015

Get a sheet of paper, write your name, and then answer the following questions:

  1. For the string "We're all alike." What is the index of the first space, the index of the second space, and the index of the period? What is the length of the string?

  2. Write what will be printed to the console after the following code:

var message = "We can't stop at all"
message = message.replace("at", "us");
Do exit ticket from last class as a warm up quiz:
https://gist.github.com/efuquen/88e8ced65ddde45e1644
Finish project from last class:
http://codepen.io/efuquen/pen/azEOOO?editors=001
I have a post project activity which I will demo here:

Requirements

At UPS, we want a weather site where the user enters a zip code and gets the current weather in that area. This is going to be displayed on monitors in our locations throughout the US during business hours so it's important that the information updates automatically (without needing to refresh the page) as the weather and temperature change. Also, we want it to be beautiful and eye catching, and for the background to be related to the current weather. We also want the current time, date, and city (based on zip code) displayed.

Resources

@efuquen
efuquen / scripted-music-3-17-2015.md
Last active August 29, 2015 14:17
ScriptEd Music Assignment 3-17-2015

Fork This: http://codepen.io/efuquen/pen/RNqxEV

##Part 1

  1. Play a D note for 1 beat, a F note for 1 beat, and a A note for 2 beats.
  2. Use a while loop to play the notes from the exercise 1 three times. Like so: D, F, A, D, F, A, D, F, A
  3. Use a while loop to play the same note 3 times for 1 beat.

##Part 2

cur_alpha_str = ""
longest_alpha_str = ""
for letter in s:
if cur_alpha_str == "" or letter > cur_alpha_str[-1]:
cur_alpha_str += letter
else:
if len(cur_alpha_str) > len(longest_alpha_str):
longest_alpha_str = cur_alpha_str
cur_alpha_str = str(letter)
cur_alpha_str = ""
long_alpha_str = ""
for c in s:
if len(cur_alpha_str) == 0 or c >= cur_alpha_str[-1]:
cur_alpha_str += str(c)
else:
if len(cur_alpha_str) > len(long_alpha_str):
long_alpha_str = cur_alpha_str
cur_alpha_str = str(c)
@efuquen
efuquen / gnews-top-stories.js
Created August 18, 2015 02:35
Google News Top Stories Scraper
var request = require('request');
var cheerio = require('cheerio');
request('https://news.google.com/', function(error, response, body) {
if (!error && response.statusCode == 200) {
getTopStories(body);
} else {
console.error(error);
console.error('Status Code: ' + response.statusCode);
}
mport csv
import locale
import sys
locale.setlocale(locale.LC_ALL, '')
csv_filepath = sys.argv[1]
winners = []
with open(csv_filepath, 'rb') as csvfile:
" Installs vim-plug.
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
" Specify a directory for plugins
" - For Neovim: ~/.local/share/nvim/plugged
" - Avoid using standard Vim directory names like 'plugin'