Skip to content

Instantly share code, notes, and snippets.

Alvaro Muir alvaromuir

Block or report user

Report or block alvaromuir

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@alvaromuir
alvaromuir / getVideoThumb.js
Last active Dec 11, 2015
Grabs large thumbnail from current YouTube or Vimeo links
View getVideoThumb.js
// helper function
function parseVideoId(link) {
// parses youtube or vimeo links.. but not vimeo shar
var urlComesAfter = {
'\\.be/': function() { return link.split('.be/')[1].replace('/','')},
'v=': function() { return link.split('v=')[1].replace('/','')},
'vimeo.com/': function() {
if (isNaN(parseInt(link.split('/').slice(-1)[0]))) {
var rawLink = link.split('/');
return [rawLink[3],rawLink[4]];
View Yeoman Index.jade
!!! 5
//[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]
//[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]
//[if IE 8]> <html class="no-js lt-ie9"> <![endif]
//[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]
html.no-js
head
meta(charset='utf-8')
meta(http-equiv='X-UA-Compatible', content='IE=edge,chrome=1')
title
@alvaromuir
alvaromuir / Gruntfile.coffee
Last active Dec 23, 2015
Ember & Jade Grunt configuration. Renders *.jade files to *.hbs from app/template and adds them to Ember.TEMPLATE
View Gruntfile.coffee
"use strict"
# # Globbing
# for performance reasons we're only matching one level down:
# 'test/spec/{,*/}*.js'
# use this if you want to recursively match all subfolders:
# 'test/spec/**/*.js'
module.exports = (grunt) ->
# show elapsed time at the end
@alvaromuir
alvaromuir / Index.jade
Last active Dec 23, 2015
Ember + RequireJS Index.jade. Includes '#webapp' div ID to use for Ember root element.
View Index.jade
!!! 5
//if lt IE 7
html.no-js.lt-ie9.lt-ie8.lt-ie7
//if IE 7
html.no-js.lt-ie9.lt-ie8
//if IE 8
html.no-js.lt-ie9
// [if gt IE 8] <!
html.no-js
// <![endif]
@alvaromuir
alvaromuir / Gruntfile.coffee
Last active Dec 24, 2015
Standard webapp Gruntfile with Jade
View Gruntfile.coffee
# Generated on 2013-10-06 using generator-webapp 0.4.2
"use strict"
# # Globbing
# for performance reasons we're only matching one level down:
# 'test/spec/{,*/}*.js'
# use this if you want to recursively match all subfolders:
# 'test/spec/**/*.js'
module.exports = (grunt) ->
@alvaromuir
alvaromuir / TumblrDemo.html
Last active Dec 25, 2015
Tumblr demo in html, sans js or iframes.
View TumblrDemo.html
<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Alvaro Muir | Thought You'd Wanna Know</title>
<meta name="description" content="Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.">
<link rel="shortcut icon" href="http://assets.tumblr.com/images/default_avatar_128.png">
View _custom.scss
// Colors:
$TURQUOISE: #1abc9c;
$GREENSEA: #16a085;
$EMERALD: #2ecc71;
$NEPHRITIS: #27ae60;
$PETERRIVER: #3498db;
$BELIZEHOLE: #2980b9;
$AMERGYST: #9b59b6;
$WISTERIA: #8e44ad;
$WETASPHALT: #34495e;
@alvaromuir
alvaromuir / Ordinals.py
Last active Dec 30, 2015
Python Ordinals
View Ordinals.py
def ordinal(n):
if 4 <= n <= 20 or 24 <= n <= 30:
return n + 'th'
else:
return str(n) + ["st", "nd", "rd"][n % 10 - 1]
View snippets
// Remove timestamp from NSLog
#define NSLog(FORMAT, ...) printf("%s\n", [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]);
@alvaromuir
alvaromuir / obj-c_marcos
Created Jan 5, 2014
Some common Objective-C Macros
View obj-c_marcos
#define PI 3.141592654
#define TWO_PI 2.0 * PI
#define SQUARE(x) ((x)*(x))
#define CUBE(x) ((x)*(x)*(x))
#define IS_LEAP_YEAR(y) y % 4 == 0 && y % 100 != 0 || y % 400 == 0
#define IS_LOWER_CASE(x) ( ((x) >= 'a') && ((x) <= 'z'))
#define TO_UPPER(x) (IS_LOWER_CASE(x) ? (x) - 'a' + 'A': (x))
#define INCHES_PER_CENT 0.394
#define CENT_PER_INCH (1/INCHES_PER_CENT)
You can’t perform that action at this time.