Skip to content

Instantly share code, notes, and snippets.

View hhsnopek's full-sized avatar
Working from home

Henry Snopek hhsnopek

Working from home
View GitHub Profile
### Keybase proof
I hereby claim:
* I am hhsnopek on github.
* I am hhsnopek (https://keybase.io/hhsnopek) on keybase.
* I have a public key whose fingerprint is DBC8 8FD3 DD50 AA75 FF1F F349 63D1 7861 D3ED 8EA1
To claim this, I am signing this object:
@hhsnopek
hhsnopek / roots-component-hack.md
Last active August 29, 2015 14:03
roots component

Roots Component working hack

  1. create component.json NOTE: Whatever you use as the name in this will be same name you use in step 3
  2. add your components and list /public/js/main.js as your script
  3. in layout.jade remove the require.js script and add:

script(src="js/build.js")
script.
require('name-from-component.js')
@hhsnopek
hhsnopek / aspect-ratio.styl
Last active August 29, 2015 14:04
keeping your aspect ratio with css
// This gist will keep your image or video's aspect ratio at 16:9 and horizontally centered
// [support](//caniuse.com/#feat=viewport-units): IE9+, Firefox 21+, Chrome 27+, Safari 6+, Android 4.4+, BlackBerry 10+
// [credit](//stackoverflow.com/a/20593342)
.video
position: relative
max-height: 100vh
max-width: 177.78vh
width: 100vw
height: 56.25vw
background-color: black
class Settings
constructor: ->
@localStorage = window.localStorage
if @localStorage?
@localStorage =
repo_name: false,
desktop_notifications: true,
oauth_token: ''

Anchors in Markdown?

To create an anchor to a heading in github flavored markdown. Add - characters between each word in the heading and wrap the value in parens (#some-markdown-heading) so your link should look like so:

[create an anchor](#anchors-in-markdown?)

@hhsnopek
hhsnopek / gist:3955c5a42f77eecf4375
Last active August 29, 2015 14:22
multiple inheritance
// Coffee
class Animal
this.species;
class Human extends Animal
this.species = "mammal";
this.sex;
class Woman extends Human
this.sex = "female";
var url = "",
obj = {};
url = window.location.href.split('?')[1].split('&');
for (var u = 0; u < url.length; u++) {
var items = url[u].split('=')
obj[items[0]] = unescape(items[1]);
};
@hhsnopek
hhsnopek / gist:9067bbe94ba029c58e96
Last active August 29, 2015 14:22
encode url parameters from obj
var newUrl = "http://localhost:1111/?",
objKeys = [];
objKeys = Object.keys(obj);
for (var u = 0; u < objKeys.length; u++) {
var key = objKeys[u];
newUrl += key + "=" + escape(obj[key]) + "&";
}
function SaferHTML(templateData) {
var s = templateData[0];
for (var i = 1; i < arguments.length; i++) {
var arg = String(arguments[i]);
// Escape special characters in the substitution.
s += arg.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;");
/app/node_modules/when/lib/decorators/unhandledRejection.js:80
2015-10-02T20:03:35.724232+00:00 app[web.1]: throw e;
2015-10-02T20:03:35.724234+00:00 app[web.1]: ^
2015-10-02T20:03:35.724235+00:00 app[web.1]: MongoError: auth failed
2015-10-02T20:03:35.724237+00:00 app[web.1]: at Object.toError (/app/node_modules/mongoose/node_modules/mongodb/lib/mongodb/utils.js:114:11)
2015-10-02T20:03:35.724238+00:00 app[web.1]: at /app/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1156:31
2015-10-02T20:03:35.724239+00:00 app[web.1]: at /app/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1890:9
2015-10-02T20:03:35.724241+00:00 app[web.1]: at Server.Base._callHandler (/app/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/base.js:448:41)
2015-10-02T20:03:35.724242+00:00 app[web.1]: at /app/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:481:18
2015-10-02T20:03:35.724252+00:00 app[web.1]: at [object Object].MongoR