Skip to content

Instantly share code, notes, and snippets.

View miguelfrias's full-sized avatar

Miguel Angel Frías Bonfil miguelfrias

  • Globant
  • Los Angeles
View GitHub Profile
/*
* a small mixin for easy use of rem with px as fallback
* usage: @include x-rem(font-size, 14px)
* usage: @include x-rem(marign, 0 12px 2 1.2)
* usage: @include x-rem(padding, 1.5 24px)
*
* thanks to Eric Meyer for https://github.com/ericam/susy
* and Hans Christian Reinl for http://drublic.de/blog/rem-fallback-sass-less/
*/
@mixin x-rem($property, $values) {
/*jslint sloppy:true, white:true, vars:true, plusplus:true */
var permutation = function (collection){
var current,
subarray,
result = [],
currentArray = [],
newResultArray = [];
if (collection.length){
@miguelfrias
miguelfrias / jshintrc
Created March 5, 2014 19:28
Recommended JSHint config
{
curly: true,
eqeqeq: true,
browser: true,
bitwise: true,
camelcase: true,
forin: true,
indent: 4,
latedef: 'nofunc',
newcap: true,
@miguelfrias
miguelfrias / sample-grunt-config
Created March 5, 2014 19:29
Sample Grunt configuration
'use strict';
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// @see http://www.jshint.com/docs/options/
jshint: {
// Files that jshint will watch
@miguelfrias
miguelfrias / Git-Tips
Last active August 29, 2015 13:57
Git Tips
# Delete previous commit (locally) but not eliminate the changes
git reset --soft HEAD~1
# Delete previous commit (locally) and the modified files
git reset --hard HEAD~1
# Delete a commit already pushed
git revert HEAD
# Pull a branch from repository
@miguelfrias
miguelfrias / Setup-after-clean-install
Last active August 29, 2015 13:57
Setup after clean install
# Programs
Chrome (https://www.google.com/intl/en/chrome/browser/)
Skype (http://www.skype.com/en/download-skype/skype-for-computer/)
Moom [App store]
Alinof timer [App store]
# Desarrollo
Xcode [App store]
@miguelfrias
miguelfrias / mysql-tips-and-tricks
Last active August 29, 2015 13:57
Mysql Tips & Tricks
# Create user
CREATE USER user IDENTIFIED BY 'password';
# Create and user (if doesn´t exist) and grant permissions
GRANT ALL ON *.* TO 'user'@'localhost' IDENTIFIED BY 'password';
# Update
UPDATE [table] SET [table_field]=[new_value] WHERE [id]=[id];
# Change user password

How to patch Ubuntu for Heartbleed

  1. sudo apt-get update
  2. sudo apt-get install -y libssl1.0.0 openssl
  3. openssl version -a and confirm the "built on" date is >= 2014-04-07
  4. sudo lsof -n | grep ssl | grep DEL and restart all listed services.

Repeat #4 until no results are returned.

@miguelfrias
miguelfrias / RunSomethingOnce
Created April 11, 2014 22:04
Run a console log just once
!opener++ && console.log('getAvatarImg cache hit', url);
Source: http://forrst.com/posts/Shorthand_Javascript_Console_Log_Once-Jta

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/