Skip to content

Instantly share code, notes, and snippets.

View smorcuend's full-sized avatar
🎯
Focusing

Sergio Morcuende smorcuend

🎯
Focusing
View GitHub Profile
Atom settings synchronization
@smorcuend
smorcuend / CORSBrowserXHR.ts
Created March 8, 2016 12:02
Angular2 feat(http): add support for withCredentials
import {BrowserXhr, HTTP_PROVIDERS} from "angular2/http";
import {Injectable, provide} from "angular2/core";
@Injectable()
class CORSBrowserXHR extends BrowserXhr{
build(): any{
var xhr:any = super.build();
xhr.withCredentials = true;
return xhr;
}
@smorcuend
smorcuend / gist:22812e128428ac62170ef970b4203086
Created April 4, 2016 17:13 — forked from solenoid/gist:1372386
javascript ObjectId generator
var mongoObjectId = function () {
var timestamp = (new Date().getTime() / 1000 | 0).toString(16);
return timestamp + 'xxxxxxxxxxxxxxxx'.replace(/[x]/g, function() {
return (Math.random() * 16 | 0).toString(16);
}).toLowerCase();
};
@smorcuend
smorcuend / webpack.base.js
Created April 27, 2016 13:07
basic config for webpack
const path = require('path');
/*
* Webpack Plugins
*/
// const webpack = require('webpack');
// const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
@smorcuend
smorcuend / jquery-scroll-spy.js
Created May 2, 2016 08:15
jQuery ScrollSpy Plugin port (as ES6 class)
/*
* jQuery ScrollSpy Plugin
* Author: @sxalexander, softwarespot
* Licensed under the MIT license
*/
import $ from 'jquery';
export default class Scrollspy {
constructor() {
@smorcuend
smorcuend / js-micro.js
Created May 16, 2016 08:18 — forked from yuval-a/js-micro.js
Javascript micro-optimizations
// Array literal (= []) is faster than Array constructor (new Array())
// http://jsperf.com/new-array-vs-literal/15
var array = [];
// Object literal (={}) is faster than Object constructor (new Object())
// http://jsperf.com/new-array-vs-literal/26
var obj = {};
// property === undefined is faster than hasOwnProperty(property)
// http://jsperf.com/hasownproperty-vs-in-vs-undefined/17
@smorcuend
smorcuend / classes.ts
Created June 10, 2016 10:55
ng2-color-picker
export class Hsva {
constructor(public h: number, public s: number, public v: number, public a: number) { }
}
export class Hsla {
constructor(public h: number, public s: number, public l: number, public a: number) { }
}
export class Rgba {
constructor(public r: number, public g: number, public b: number, public a: number) { }
}
export class SliderPosition {
@smorcuend
smorcuend / git_aliases_cheatsheet.md
Last active October 20, 2016 12:08
git aliases cheatsheet for ZSH

Git

Dynamic access to current branch name with the current_branch function
git pull origin $(current_branch)
grb publish $(current_branch) origin
Alias Command
g git
@smorcuend
smorcuend / docker-compose_aliases_cheatsheet_ZSH.md
Last active October 20, 2016 10:58
docker-compose aliases cheatsheet for ZSH
@smorcuend
smorcuend / hal.css
Created December 11, 2016 21:28
HAL - CSS
html{height:100%;}
body{
background: #232323;
width: 100%;
height: 100%;
padding: 0px;
margin: 0px;
}
.wrapper{position:relative;