Skip to content

Instantly share code, notes, and snippets.

View aboutaaron's full-sized avatar

Aaron Williams aboutaaron

View GitHub Profile
/*!
* toggleAttr() jQuery plugin
* @link https://gist.github.com/aboutaaron/6916c539db4ee9f66d51
* @description .toggleClass() but for attrs. Useful for toggling classes with SVGs or anything that's not a class
* @author Aaron Williams <http://aboutaaron.com/>
* @thanks: Mathias Bynens <http://mathiasbynens.be/> for original
*/
jQuery.fn.toggleAttr = function(attr, value) {
return this.each(function() {
var $this = $(this);
# When to scrape
## What is web scraping
The process of harvesting or collecting information from a web page
Automating server request
Can be done by writing a script (code) or with paid software tools, e.g., Helium Scraper
Can even be done simply by using Excel and wget
@aboutaaron
aboutaaron / notes.md
Created July 25, 2014 19:14
srccon-javascript

@aboutaaron
aboutaaron / js-notes
Created July 25, 2014 20:32
JS notes
# New frontiers in javascript: the browser at the bleeding edge
## Possible futures
1. new libs (new jQuery)
2. ECMAscript 6
3. Make your own (sweet.js)
4. web assembly (coffeescript)
## 1. New Libs
- React.js: shadow DOM (diffing shadow DOM to DOM)
- calculate differences in DOM nodes
@aboutaaron
aboutaaron / mozfest-2014-notes.md
Created October 25, 2014 10:47
Notes from Mozfest

Rise of the sentient article

  • telescopic text
  • tangle.js
  • sports, elections, personal finance
ssh: connect to host ec2-54-190-57-155.us-west-2.compute.amazonaws.com port 22: Connection timed out
Fatal error: local() encountered an error (return code 255) while executing 'ssh ubuntu@ec2-54-190-57-155.us-west-2.compute.amazonaws.com -i /home/aaron/.ec2/calaccess.pem'
Aborting.
local() encountered an error (return code 255) while executing 'ssh ubuntu@ec2-54-190-57-155.us-west-2.compute.amazonaws.com -i /home/aaron/.ec2/calaccess.pem'
@aboutaaron
aboutaaron / cayuga_aaronwilliams.markdown
Created December 17, 2011 19:20
Aaron Williams - Articles

Cayuga Park in San Francisco sees future renovation

Ingleside Light, Summer 2010

Cayuga Park has seen better days.

The famous park has a fence and chains around its play areas and the clubhouse closed two years ago due to plumbing issues. However, plans to rebuild Cayuga Park are in the final stag- es as community members and city departments figure out to maintain and enhance the garden-like vibe of the park.

The joint venture between the city’s Parks and Recreation Department, The Cayuga Improvement Association and the San Francisco Arts Commission needs final approval from the Art Commission, which is scheduled to happen in September. Prospective park builders will then be sought for afterward. Funding for the park came from the 2008 voter-approved $185 million Neighborhood Parks bond that gave money to parks in dire need of repair. Funding also came from BART to replace the playground area that will be removed while they rebuild the track support columns.

@aboutaaron
aboutaaron / Highcharts Tooltip
Created October 4, 2012 20:22
Shitty load in IE6-9?
tooltip: {
useHTML: true,
formatter: function() {
// This is using the Highcharts tooltip API plus the JS ternary operator to conditionally add tooltips to the accumulated gross
// http://stackoverflow.com/a/7344366/868724
return this.x + "<br>" + this.series.name + ': <strong>$' + Highcharts.numberFormat(this.y) + '</strong>' + ( typeof this.point.weeks !== "undefined" ? "<br>Weeks in box office: " + this.point.weeks : "" )
},
@aboutaaron
aboutaaron / index.html.erb
Created October 4, 2012 20:55
Ruby highcharts erb
<script type="text/javascript">
$(function () {
// Creating styles here to keep boilerplate down
var chartStyles = {
fontSize: '14px',
fontWeight: 'normal',
color: '#231F20',
fontFamily: "Georgia, 'Times New Roman', Times, serif",
textTransform: 'uppercase'
@aboutaaron
aboutaaron / index.html
Created October 17, 2012 23:36
YouTube player from Edmonton Journal
<script src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
function onYouTubePlayerReady(playerId) {
ytplayer = document.getElementById("myytplayer");
setInterval(updateytplayerInfo, 250);
updateytplayerInfo();
ytplayer.addEventListener("onStateChange", "onytplayerStateChange");
ytplayer.addEventListener("onError", "onPlayerError");
}