Skip to content

Instantly share code, notes, and snippets.

View alterx's full-sized avatar

Carlos Vega alterx

View GitHub Profile
@alterx
alterx / functionsAndOperators.less
Last active August 29, 2015 14:07
Doing LESS with style
@width: 100%;
@column-width: @width / 3;
@base-color: #cfcfcf;
.container {
width: @width;
.column {
width: @column-width;
}
@alterx
alterx / meteor.sh
Last active August 29, 2015 14:09
Meteor stack install for ubuntu
#!/bin/bash
sudo apt-get update
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
echo "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen" | sudo tee -a /etc/apt/sources.list.d/10gen.list
sudo apt-get update
sudo apt-get install -y git mongodb-org nodejs npm
curl https://raw.githubusercontent.com/creationix/nvm/v0.18.0/install.sh | bash
curl https://install.meteor.com | sudo sh
@alterx
alterx / debounce.js
Created February 6, 2015 20:42
Debounce service for angularJS
// Modified version of http://jsfiddle.net/6K7Kd/68/ to support parameters, and inmediate execution
(function (/*window*/) {
'use strict';
function debounceService($rootScope, $browser, $q, $exceptionHandler) {
var deferreds = {},
methods = {},
uuid = 0;
@alterx
alterx / SEO meta tag helper
Last active December 19, 2015 07:39
This is a small script that will basically crawl a page and log the names and values of: -Title -Metas -Links You can add values to the check Object for specific metas to show. The showAll flag can be turned on to show all the links, metas and the title tag. The ommit Object can contains metas and links that you want to exclude (even if showAll …
var check = {
description : 'Description',
title : 'Title',
image : 'Image',
canonical : 'Canonical',
'og:image' : 'Open graph image',
'twitter:image' : 'Twitter Image'
},
ommit = {
@alterx
alterx / functions.js
Last active October 5, 2016 11:55
Vanilla Javascrip Basics
// Function declaration
foo(); // It works! :D
function foo() {
console.log('I got hoisted, so basically you can call me wherever you want to. Even before my declaration.');
}
// Function Expression
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template: `
<my-child-component [prop1]="name"></my-child-component>
`,
})
export class App {
name: string = "Carlos";
constructor() {}
import { Component, Input } from '@angular/core';
@Component({
selector: 'my-child-component',
template: `
<p>{{ prop1 }}</p>
`,
})
export class ChildComponent {
@Input() prop1: string;
constructor() {}
@alterx
alterx / child.ts
Last active November 22, 2016 17:32
Angular 2 @input() change detection with TypeScript accessors
import { Component, Input, OnInit } from '@angular/core';
@Component({
selector: 'my-name',
template: `
<h2>First name: {{name}} ({{_name}})</h2>
`,
})
export class ChildComponent implements OnInit {
private _name: string;
@alterx
alterx / koa-simple-waterline.js
Last active February 25, 2017 23:23
Simple Koa 2 middleware that transparently exposes Waterline (node 7.6+)
'use strict';
const Waterline = require('waterline');
let _waterline;
const upper = (str) => str[0].toUpperCase() + str.slice(1);
const isInvalid = (model) => (!model.identity);
const init = async ({ models, adapters, connections }) => {
if (_waterline) return Promise.resolve(_waterline);

Keybase proof

I hereby claim:

  • I am alterx on github.
  • I am carlosvega (https://keybase.io/carlosvega) on keybase.
  • I have a public key whose fingerprint is 36F2 3290 97D7 D20C 0B80 B789 DE03 05A8 C729 643A

To claim this, I am signing this object: