Skip to content

Instantly share code, notes, and snippets.

View cristianferrarig's full-sized avatar

Cristian Ferrari cristianferrarig

  • VOLTΛ
  • Stgo, Chile
View GitHub Profile
/* Initialisation / Button events */
// If added to home screen...
if(navigator.standalone === undefined || !!navigator.standalone) {
// On Android scroll the screen by 1 pixel to hide the address bar
if (navigator.userAgent.match(/Android/i)) {
window.addEventListener("load", function() { window.scrollTo(0,1); }, false);
}
// Show the converter & hide the install option by default
<% if current_article %>
<title><%= "#{current_article.title}" %></title>
<meta name="twitter:card" content="summary">
<meta property="twitter:creator" content="@alexbaldwin">
<meta name="twitter:title" content="<%= truncate(current_article.title, length: 70) %>">
<meta name="twitter:image" content="<%= "#{current_article.data.image}" %>">
<meta name="twitter:description" content="<%= truncate(strip_tags(current_article.summary), length: 200) %>">
<meta name="twitter:domain" content="<%= "http://www.alexbaldwin.com#{current_article.url}" %>">
<% else %>
ActiveSupport::Inflector.inflections do |inflect|
inflect.plural /([aeiou])([A-Z]|_|$)/, '\1s\2'
inflect.plural /([rlnd])([A-Z]|_|$)/, '\1es\2'
inflect.plural /([aeiou])([A-Z]|_|$)([a-z]+)([rlnd])($)/, '\1s\2\3\4es\5'
inflect.plural /([rlnd])([A-Z]|_|$)([a-z]+)([aeiou])($)/, '\1es\2\3\4s\5'
inflect.singular /([aeiou])s([A-Z]|_|$)/, '\1\2'
inflect.singular /([rlnd])es([A-Z]|_|$)/, '\1\2'
inflect.singular /([aeiou])s([A-Z]|_)([a-z]+)([rlnd])es($)/, '\1\2\3\4\5'
inflect.singular /([rlnd])es([A-Z]|_)([a-z]+)([aeiou])s($)/, '\1\2\3\4\5'
@cristianferrarig
cristianferrarig / _pems.scss
Last active December 14, 2015 13:48 — forked from mrdanadams/_pems.scss
PX to EMs conversion in Sass
/* See http://mrdanadams.com/2012/pixel-ems-css-conversion-sass-mixin/ */
/* Default font size in pixels if not overridden. */
$baseFontSize: 16px;
/* Remove PX units to prevent sass errors
(inspired by https://gist.github.com/moyarich/3260638)
Ex: $base: remove-px($base);
*/
@function remove-px($target){