Skip to content

Instantly share code, notes, and snippets.

@efuquen
efuquen / knife-role-node-list
Created April 17, 2012 21:04
Lists all the nodes that fall under a specified role
#!/bin/bash
function search_node {
NODE_ROLES=$(knife node show $1 | grep Roles | grep $2)
if [ "" != "$NODE_ROLES" ]
then
echo "$1"
fi
}
@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);
}
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)
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)
@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

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

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:
@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");
@efuquen
efuquen / mihs-functions.md
Last active August 29, 2015 14:13
MIHS Functions
@efuquen
efuquen / mihs-scripted-12-10-2014
Last active August 29, 2015 14:11
MIHS ScriptEd - December 10th 2014
Do Now
- open nitrous
- create 'space-invader' folder
- in this folder create 'index.html'
- copy the html on screen' (https://gist.github.com/efuquen/85284d6d64d3692b1734)
Lecture
- Go over what an algorithm is.
- Explain javascript (*real programming*)
- Discuss difference between js & css/html