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
@miguelfrias
miguelfrias / Unix find commands
Created January 3, 2015 09:38
Unix find commands
# Find files by name
find . -name YourName
# Find files by name with pattern
find . -name *YourName.*
# Find files by extension, and then search for a pattern
find . -name "*.php" -exec grep -l "qV" {} \;
# Find files by extension, and then search for a pattern with REGET
#!/bin/bash
siteName="{NAME}"
targetHTML="{your backup dir}"
backupDirHTML="{destination for backup}"
backupDirDB="{destination for backup}"
filenameBackupHTML="code-$siteName-$(date +"%Y%m%d-%H%M%S").tar.gz"
@miguelfrias
miguelfrias / SASS-Mixin-for-buttons
Created December 4, 2014 16:21
One Sass Color to Rule Them All
//http://www.elijahmanor.com/one-sass-color-to-rule-them-all/
@import url(http://fonts.googleapis.com/css?family=Open+Sans);
@mixin Button-theme($colorBase, $colorBorder, $colorShadow) {
background-color: $colorBase;
background-image: linear-gradient(top, $colorBase 0%, $colorBorder 100%);
border: 1px solid $colorBorder;
text-shadow: $colorShadow 0 -1px 1px;

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

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/
@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

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 / 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
@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 / 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