Skip to content

Instantly share code, notes, and snippets.

View pushmatrix's full-sized avatar

Daniel Beauchamp pushmatrix

View GitHub Profile
@pushmatrix
pushmatrix / javascript
Last active December 24, 2015 11:29
Solutions for jQuery Workshop
$(document).ready(function() {
//////////////
// EXERCISE 2
// Add your code below here so that an alert message pops up when you press that button
$("#exercise2Button").on('click',
function() {
alert("You rock!");
}
@pushmatrix
pushmatrix / gist:6777403
Created October 1, 2013 12:01
Le example # 1991
/*
Exercise Nouveau!
*/
console.log("exercise nouveau!");
person1 = {
name: "Pippi",
gender: "Female",
city: "Stockholm"
}
@pushmatrix
pushmatrix / gist:6685130
Created September 24, 2013 13:56
Linking to an External Style Sheet
<h3>Overview</h3>
<p>Up to this point in the course you have learned how to add style to your
web pages by inserting a style section using the <strong>&lt;style&gt;</strong> element. But what
if you want to change the look of the entire website? If your entire website
was built with style definitions inside each page, that would mean going back
into each page individually and changing the style. Fortunately, CSS provides
a means of using an external style sheet to control the presentation of a large
set of web pages. With an external style sheet, if you want to change the font
style (or any other style definition) across an entire site, you only have
to change it in one place. </p>
@pushmatrix
pushmatrix / gist:6570585
Last active May 23, 2023 17:17
How to get started building a ship tracking app.
- Find an API that supplies the data.
- I found the one that MarineTraffic.com uses (http://www.marinetraffic.com)
- Open your computer's terminal, and paste this:
curl 'http://www.marinetraffic.com/ais/getjson.aspx?sw_x=0&sw_y=70&ne_x=30&ne_y=80&zoom=6&fleet=&station=0&id=null' -H 'Referer: http://www.marinetraffic.com/ais/'
- This shows you all the data. You will now need to automate calling this API
- Get the data from the API using something like jQuery:
- Documentation: http://api.jquery.com/jQuery.getJSON/
- Tutorial :http://www.youtube.com/watch?v=3hN4PrJ7R6A
@pushmatrix
pushmatrix / translations.js
Created August 20, 2013 02:05
Translations
FS.keywords = {
function: 'funktion',
if: 'om',
else: 'annars',
for: 'för',
while: 'medan',
return: 'återvända',
do: 'göra',
var: 'var',
in: 'inne',
@pushmatrix
pushmatrix / gist:5598003
Created May 17, 2013 09:28
This is the solution for the assignment.
$(document).ready(function() {
$("#search").click(function() {
$.getJSON('https://api.instagram.com/v1/tags/snow/media/recent?callback=?&access_token=198349558.f59def8.84479f9173f144df8374d6f0edefaf5d',function(data){
$.each(data.data, function(i, post) {
$('body').append('<img src="' + post.images.standard_resolution.url + '"/>');
});
});
});
});
@pushmatrix
pushmatrix / instagramviewer.md
Last active December 17, 2015 09:38
Hyper Island DDS task: Create an Instagram viewer
@pushmatrix
pushmatrix / gist:4035423
Created November 7, 2012 23:44
Testing out whether V8 within Chrome runs garbage collection on global variables (assigned to window)
<script>
function logMemory() { console.log("Heap use(MB): " + window.performance.memory.usedJSHeapSize / 1000000, ", Total heap size(MB): " + window.performance.memory.totalJSHeapSize / 1000000) };
window.things = {};
things.array = [];
function leak() {
for(var i = 0; i < 5000000; i++) {
things.array.push("test string");
}
}
@pushmatrix
pushmatrix / push.rb
Created October 30, 2012 15:51
Ruby use of Dashing API
HTTParty.post('http://localhost:3030/widgets/karma',
:body => { auth_token: "YOUR_AUTH_TOKEN", current: 1000 }.to_json)
@pushmatrix
pushmatrix / push.sh
Created October 30, 2012 07:43
Sample dashing API call
curl -d '{ "auth_token": "YOUR_AUTH_TOKEN", "current": 100 }' http://localhost:3030/widgets/karma