start new:
tmux
start new with session name:
tmux new -s myname
#!/bin/bash | |
# Functions ============================================== | |
# return 1 if global command line program installed, else 0 | |
# example | |
# echo "node: $(program_is_installed node)" | |
function program_is_installed { | |
# set to 1 initially | |
local return_=1 |
#!/bin/bash | |
# A shell script to restore a large SQL dump using root login. | |
# Usage: ./restore_dump.sh dump.sql app_devdb | |
# | |
# Author: Michael de Silva (michael@mwdesilva.com / http://github.com/bsodmike) | |
(( $# != 2 )) && { echo "Usage: $0 dump.sql database_name"; exit 1; } | |
[ ! -f $1 ] && { echo "$1 not found1"; exit 1; } | |
RESULT=`mysql -u root -p --skip-column-names -e "SHOW DATABASES LIKE '$2'"` |
#!/bin/bash | |
SCHEMA="support_mozilla_com.2013.07.17.schema.sql" | |
DATA="support_mozilla_com.2013.07.17.data.sql" | |
SIZE="$(du $DATA | awk '{ print $1 }')K" | |
DBNAME="kitsune" | |
{ | |
echo "Dropping/creating database ${DBNAME}" >&2 | |
echo "DROP DATABASE IF EXISTS ${DBNAME};" |
# Assuming an Ubuntu Docker image | |
$ docker run -it <image> /bin/bash |
URL | HTTP Verb | Action |
---|---|---|
/photos/ | GET | index |
/photos/new | GET | new |
/photos | POST | create |
/photos/:id | GET | show |
/photos/:id/edit | GET | edit |
/photos/:id | PATCH/PUT | update |
/photos/:id | DELETE | destroy |
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft
, elem.offsetTop
, elem.offsetWidth
, elem.offsetHeight
, elem.offsetParent
# The idea of this deployment script is to create a deploy copy of your website and handle | |
# Git and Composer updates in there. Aferwards, it just renames that deploy copy to become the | |
# live website. We then run the database migrations and take the application out of maintenance mode. | |
# Obviously, you will have to replace all instances of {{ websiteName }} with the name of your website and | |
# {{ branchName }} with the name of the branch you would like to pull changes from. This is usually the master branch. | |
# Start by checking for for old deployment folder and remove it if we have one. | |
if [ -d "/home/forge/{{ websiteName }}-deploy" ]; then | |
rm -Rf /home/forge/{{ websiteName }}-deploy |
#!/bin/sh | |
# Import a large sql dump file to a MySQL database from command line | |
# https://cmanios.wordpress.com/2013/03/19/import-a-large-sql-dump-file-to-a-mysql-database-from-command-line/ | |
# store start date to a variable | |
imeron=`date` | |
echo "Import starting..." | |
dumpfile="/path/to/dumpfile.sql" |