Skip to content

Instantly share code, notes, and snippets.

View garretttaco's full-sized avatar

Garrett Tacoronte garretttaco

View GitHub Profile
@garretttaco
garretttaco / Docker_setup.md
Last active August 29, 2015 14:27
Docker file

###Step 1 make sure xdebug is installed and as a zend extension.

sudo apt-get install php5-dev && sudo apt-get install php-pear

sudo pecl install xdebug

sudo apachectl restart

make sure xdebug has an .ini file check if there is one for your whole system or multiple. ( force php and apache to use the same conf.d xdebug.ini file)

drun() {
  if [[ $# -eq 0 ]]
    then
      echo "Which container? Provide 1 argument."
      return 0
  fi

  case "$1" in

'web' )

DNS_PROBE_FINISHED_BAD_CONFIG chrome fix on mac

Go to system preferences > network

then select the connection type on the left. Click advanced on bottom right for that connection.

Proceed to the dns tab. from there I replaced the current server : 192.168.1.1 with googles dns server ipv4 : 8.8.4.4

@garretttaco
garretttaco / .bash_profile
Last active April 15, 2017 00:08
This is my ever improving bash_profile/bashrc file that I use on my computers.
#Add vim to command line
set -o vi
# Random
alias ll='ls -la'
alias apache='sudo apachectl restart'
alias hosts='sudo vi /etc/hosts'
alias mysqlstart='sudo launchctl load -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist'
alias mysqlstop='sudo launchctl unload -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist'
alias eip='curl icanhazip.com'
alias iip='ifconfig | grep 192'
@garretttaco
garretttaco / convert.sh
Created October 20, 2016 23:06
Convert git repo clone from https to ssh
#/bin/bash
#-- Script to automate https://help.github.com/articles/why-is-git-always-asking-for-my-password
REPO_URL=`git remote -v | grep -m1 '^origin' | sed -Ene's#.*(https://[^[:space:]]*).*#\1#p'`
if [ -z "$REPO_URL" ]; then
echo "-- ERROR: Could not identify Repo url."
echo " It is possible this repo is already using SSH instead of HTTPS."
exit
fi
@garretttaco
garretttaco / internal_redirect.md
Last active January 25, 2017 21:08
View localhost website from another device, with the internal ip address

The setup I am using, is I have a Node.js, express server that is listening on port 1337 using the host 127.0.0.1. I then have Webpack dev server running on port 3000 and it proxies all traffic from 3000 to 1337, the server. Webpack dev server runs as a default on host 127.0.0.1 and for security reasons, other computers internally cannot access any server from that host. As a fix, I had to change the (default) host to 0.0.0.0 in order to then access the internal ip and port (http://192.168.100.54:3000).

References:

http://stackoverflow.com/a/30712750

@garretttaco
garretttaco / delete_node_modules
Created April 19, 2017 22:55
Delete node_modules that have not been touched after 60 days.
#!/bin/bash
delete_nm() {
find $1 -type d -maxdepth 1 -mtime +60 | xargs -I $ find $ -type d -name node_modules -maxdepth 1 -exec echo rm -rf {} \;
read -p "Are you sure you wish to delete the node_modules folders above? " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
find ~/Projects -type d -maxdepth 1 -mtime +60 | xargs -I $ find $ -type d -name node_modules -maxdepth 1 -exec rm -rf {} \;
echo "Finished delete"
fi
// Separate the container and presentional components
import React, { Component } from 'react'
// Presentational component is pure. It is only responsible for accepting props and returning JSX.
const Child = ({ show, onClickShow, onClickHide }) => (
<div>
{show && <span>Now you can see me!</span>}
<button onClick={onClickShow}>Show</button>
<button onClick={onClickHide}>Hide</button>
@garretttaco
garretttaco / withPropertyHandlers.js
Last active June 17, 2017 05:07
Prototype withHandlers HoC to declare updater handlers based on object keys.
// Definition - withPropertyHandlers.js
import { compose, withHandlers } from 'recompose'
function upperCaseFirstCharacter(str) {
return `${str.charAt(0).toUpperCase()}${str.slice(1)}`
}
export default function withPropertyHandlers(
properties,
updaterName,
updater,