Skip to content

Instantly share code, notes, and snippets.

Avatar

Aaron Buchanan aaronbuchanan

View GitHub Profile
View scrape.js
var request = require('request');
var _ = require('underscore');
var url = "http://forecast.weather.gov/product.php?site=NWS&issuedby=OKX&product=PNS&format=txt&version=1&glossary=0";
var header = "********************STORM TOTAL SNOWFALL********************";
var footer = "**********************24 HOUR SNOWFALL**********************";
request(url, function(err, resp, body) {
if (err) throw err;
View gist:9283770
This fix is from substack in the comments on here:
http://blog.npmjs.org/post/78085451721/npms-self-signed-certificate-is-no-more
(apologies for being unable to permalink directly to the comment)
-----
In travis-ci you can work around this by setting:
before_install:
- npm config set ca ""
@subatomicceo
subatomicceo / gist:11190993
Last active Aug 29, 2015
Tumblr Icomoon Font Icons Not Rendering Properly In Firefox
View gist:11190993

Problem

While working on The Giver Movie's Official Tumblr I ran across a problem. It seems that my icomoon font icons failed to render properly in Firefox. The issue is due to the fact that Firefox doesn't allow cross-domain fonts. The traditional solve is to add the following to your .htaccess: Header set Access-Control-Allow-Origin "*".

However, I have no control over the .htaccess due to the fact that my code will be hosted on Tumblr.com. So, I attempted to upload the font files through Tumblr's static upload page. This also failed because Firefox treats subdomains the same as cross-domains.

Solution

Below is my original snippet:

@simevidas
simevidas / es6-numbers-summary.md
Last active Sep 21, 2015
A summary of Nicolas Bevacqua’s post on ES6 Number improvements
View es6-numbers-summary.md

ES6 Number improvements

  • use the 0b prefix for binary, and the 0o prefix for octal integer literals
  • Number.isNaN and Number.isFinite are like their global namesakes, except that they don’t coerce the argument to Number
  • Number.parseInt and Number.parseFloat are exactly the same as their global namesakes
  • use Number.isInteger to check if the argument is a Number value that doesn’t have a decimal part
  • use Number.EPSILON to check if the difference between two Number values is negligible (e.g. the difference between 0.1 + 0.2 and 0.3 is negligible)
  • Number.MAX_SAFE_INTEGER and Number.MIN_SAFE_INTEGER are the largest and smallest integers that can be safely and precisely represented in JavaScript
  • use Number.isSafeInteger to check if an integer is within those bounds
@mbleigh
mbleigh / comparison.md
Last active Nov 4, 2015
Comparing the features of Divshot and Firebase static web hosting.
View comparison.md

Divshot/Firebase Hosting Feature Comparison

Feature Divshot Firebase
Global CDN
Custom Domains
SSL Supported
Command-Line Tools
Simple Rollback
Free w/ Firebase
@mjackson
mjackson / FirebaseStateMixin.js
Last active Feb 5, 2016
A simple mixin for React components that need to bind state to a Firebase ref
View FirebaseStateMixin.js
var Firebase = require('firebase');
var baseRef = new Firebase('https://my-firebase.firebaseio.com');
function getSnapshotValue(snapshot) {
return snapshot.val();
}
/**
* A mixin for components that want to bind the value of a state variable
* to the value at a Firebase ref.
View ArcadeControl.js
let noop = function() {
};
export default class ArcadeController {
static factory(moveStartCallback, moveCallback, fireCallback, cbContext) {
return new Phaser.ArcadeController(this.game, moveStartCallback, moveCallback, fireCallback, cbContext)
}
constructor(game, moveStartCallback = noop, moveCallback = noop, fireCallback = noop, callbackContext) {
game.input.holdRate = 150;
game.input.touch.consumeDocumentTouches();
View gist:68b41fa7f2c5aa74e0ac
@implementation InterfaceController
{
SRWebSocket *_webSocket;
}
- (void)awakeWithContext:(id)context {
[super awakeWithContext:context];
}
- (IBAction)didOpen {
View Better Git Commit Messages
https://news.ycombinator.com/item?id=13889155
7 git rules:
1. Separate subject from body with a blank line
2. Limit the subject line to 50 characters
3. Capitalize the subject line
4. Do not end the subject line with a period
5. Use the imperative mood in the subject line
6. Wrap the body at 72 characters
@bryanveloso
bryanveloso / brew-services.rb
Created Dec 8, 2011 — forked from lwe/brew-services.rb
External script for homebrew to simplify starting services via launchctl, out of the box support for any formula which implements #startup_plist. (This version fixes the deprecation warning raised on Formula.resolve_alias.)
View brew-services.rb
#!/usr/bin/env ruby -w
# brew-services(1) - Easily start and stop formulas via launchctl
# ===============================================================
#
# ## SYNOPSIS
#
# [<sudo>] `brew services` `list`<br>
# [<sudo>] `brew services` `restart` <formula><br>
# [<sudo>] `brew services` `start` <formula> [<plist>]<br>
You can’t perform that action at this time.