Skip to content

Instantly share code, notes, and snippets.

View alvaromuir's full-sized avatar

Álvaro Muir alvaromuir

View GitHub Profile
@alvaromuir
alvaromuir / snippets
Created January 3, 2014 22:21
Snippets
// Remove timestamp from NSLog
#define NSLog(FORMAT, ...) printf("%s\n", [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]);
@alvaromuir
alvaromuir / Ordinals.py
Last active December 30, 2015 01:48
Python Ordinals
def ordinal(n):
if 4 <= n <= 20 or 24 <= n <= 30:
return n + 'th'
else:
return str(n) + ["st", "nd", "rd"][n % 10 - 1]
@alvaromuir
alvaromuir / _custom.scss
Created November 29, 2013 22:42
FlatUI Colors
// Colors:
$TURQUOISE: #1abc9c;
$GREENSEA: #16a085;
$EMERALD: #2ecc71;
$NEPHRITIS: #27ae60;
$PETERRIVER: #3498db;
$BELIZEHOLE: #2980b9;
$AMERGYST: #9b59b6;
$WISTERIA: #8e44ad;
$WETASPHALT: #34495e;
@alvaromuir
alvaromuir / TumblrDemo.html
Last active December 25, 2015 01:09
Tumblr demo in html, sans js or iframes.
<!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">
@alvaromuir
alvaromuir / Gruntfile.coffee
Last active December 24, 2015 20:09
Standard webapp Gruntfile with Jade
# 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 / Index.jade
Last active December 23, 2015 16:09
Ember + RequireJS Index.jade. Includes '#webapp' div ID to use for Ember root element.
!!! 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 December 23, 2015 16:09
Ember & Jade Grunt configuration. Renders *.jade files to *.hbs from app/template and adds them to Ember.TEMPLATE
"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
!!! 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 / getVideoThumb.js
Last active December 11, 2015 22:28
Grabs large thumbnail from current YouTube or Vimeo links
// 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]];
@alvaromuir
alvaromuir / hdfs-yarn-spark
Last active August 29, 2015 14:14
Ambari 1.7.0 blueprint for a dockerized cluster build
{
"configurations": [
{
"nagios-env": {
"nagios_contact": "alvaromuir@gmail.com"
}
}
],
"host_groups": [
{