Skip to content

Instantly share code, notes, and snippets.

View alexdiliberto's full-sized avatar

Alex DiLiberto alexdiliberto

View GitHub Profile
@mike-north
mike-north / GithuOrgPages_NavigationWorkaround.md
Created June 2, 2015 19:12
Github Org and User Pages - Hash navigation workaround

Github Org and User Pages URL Redirect

If you are using "hash" navigation for a single page app on Github Org or User Pages, you may run into a URL problem.

The Problem

Users who visit a url like

http://myorg.github.io/upcoming-events
@ryanflorence
ryanflorence / post-receive.rb
Created July 16, 2010 20:03
Ruby Git post-receive hook to parse out the stdin and assign them to variables
#!/usr/bin/env ruby
# figure out which repository this is
# assumes it's a bare repository
repository = /([^\/]*?)\.git$/.match(`pwd`.chomp)[1]
# get the stdins from git
stdins = []; stdins << $_ while gets
stdins.each do |str|
@jayphelps
jayphelps / isValidEmail.js
Last active September 24, 2015 05:03
Validates an email, error on the side of letting bad ones through (best practice). Accepts emails with plus signs.
function isValidEmail(str) {
/**
* These comments use the following terms from RFC2822:
* local-part, domain, domain-literal and dot-atom.
* Does the address contain a local-part followed an @ followed by a domain?
* Note the use of lastIndexOf to find the last @ in the address
* since a valid email address may have a quoted @ in the local-part.
* Does the domain name have at least two parts, i.e. at least one dot,
* after the @? If not, is it a domain-literal?
*
@joelkallman
joelkallman / rsvp-extension.js
Created March 1, 2014 20:52
Ember RSVP spread method
(function (RSVP) {
if (!RSVP) {
return;
}
/**
Spread is utilized with the all() method.
Basic Usage:
@remy
remy / easy-list.md
Last active January 4, 2016 06:19
Markdown pro tip: long numbered list made easier
  1. One
  • Two
  • Three
  • Four
  • Five

But really easy to re-sort because the items aren't really numbered:

1. one
@amk221
amk221 / escape.js
Last active February 9, 2016 17:45
Ember escape helper
import Ember from 'ember';
import { helper } from 'ember-helper';
import { htmlSafe } from 'ember-string';
const { escapeExpression } = Ember.Handlebars.Utils;
/**
* This helper escapes a value, useful for building styles
*
* @example
* <div style={{escape (concat 'color:' ugcColour)}}></div>
@tim-evans
tim-evans / helpers.is-active.js
Last active June 10, 2016 20:53
Router Service RFC polyfill
import Ember from 'ember';
const { get, observer } = Ember;
/**
Returns whether a route is currently active
Example:
```handlebars
@davidensinger
davidensinger / summary-twitter-card-in-jekyll.html
Last active June 13, 2016 12:03
Support for the Summary Twitter Card in Jekyll
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@site_username">
<meta name="twitter:creator" content="@creator_username">
{% if page.title %}
<meta name="twitter:title" content="{{ page.title }}">
{% else %}
<meta name="twitter:title" content="{{ site.title }}">
{% endif %}
{% if page.url %}
<meta name="twitter:url" content="{{ site.url }}{{ page.url }}">
@rohmann
rohmann / app-view.js
Created September 14, 2016 18:50
Add class to Ember Application (after 2.7.0)
// instance-initializers/app-view.js
// With an instance initializer, we can register a component for Ember to use at the top level.
// Not ideal, but it works in the meantime until routable components drop.
import Ember from 'ember';
const AppView = Ember.Component.extend({
classNames: ['my-app'],
});
@mike-north
mike-north / enemy_of_the_state.md
Last active January 11, 2017 04:29
EmberFest 2016 - Enemy of the state