Skip to content

Instantly share code, notes, and snippets.

View datawebbie's full-sized avatar

Francis Park datawebbie

  • Greenpeace
  • Auckland, New Zealand
View GitHub Profile
@datawebbie
datawebbie / git tips
Last active August 6, 2018 11:24
GIT Tips: When working in a multi OS team, make sure everyone in the team get their git line ending setting correctly. Not doing so could cause serious trouble later.
=== SETUP ===
For windows clients set autocrlf to true by typing:
$ git config --global core.autocrlf true
For Unix/Mac
$ git config --global core.autocrlf input
ALSO RUN this to change all file line endings on Linux/Mac
find . -name "*" -type f -exec dos2unix {} \;
# Test URI
# Ignore netbeans folder
nbproject/*
# Ignore private folder
/app/private/*
!/app/private/empty
# Ignore packed asset files
/app/webroot/css/packed/*
@datawebbie
datawebbie / .gitattributes
Last active December 16, 2015 18:30
My current git init template for web projects
# This file only works for git version 1.6+
# Handle line endings automatically for files detected as text
# and leave all files detected as binary untouched.
* text=auto
# These files are text and should be normalized (Convert crlf => lf)
*.adoc text
*.css text
*.csv text
*.ctp text
@datawebbie
datawebbie / git framework patch
Last active December 23, 2015 18:59
Proper framework version upgrade procedure with original author's commit history intact. Follows the git branching model (http://nvie.com/posts/a-successful-git-branching-model/) that I currently use.
Start with cloning the framework's repository (in this example Wordpress) in your local machine.
$ git clone https://github.com/WordPress/WordPress.git
If you get an error like this - "Did you intend to checkout 'tags/xxxxx' which can not be resolved as commit?", fetch new tags.
$ git fetch origin --tags
Create separate branches for the current verion you are using and the version you want to upgrade to.
$ git checkout -b 3.6-branch tags/3.6
$ git checkout -b 3.6.1-branch tags/3.6.1
@datawebbie
datawebbie / google_spreadsheet_id_conversion
Created November 7, 2013 22:31
Google Spreadsheet Sheet.ID -> gid conversion table.
GID_TABLE = {
'od6': 0,
'od7': 1,
'od4': 2,
'od5': 3,
'oda': 4,
'odb': 5,
'od8': 6,
'od9': 7,
'ocy': 8,
@datawebbie
datawebbie / download-website
Last active June 1, 2017 10:52
Download/Backup/Sync whole website
wget -p -e robots=off --wait 1 URL
@datawebbie
datawebbie / no-frame-youtube-video
Created March 6, 2014 23:53
YouTube video link with no frame or controls
https://www.youtube.com/embed/okFKnjfA_uE?controls=0&modestbranding=1&origin=https%3A%2F%2Fwww.google.co.nz&rel=0&showinfo=0&wmode=transparent&enablejsapi=1
@datawebbie
datawebbie / 0_reuse_code.js
Created March 24, 2014 20:52
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@datawebbie
datawebbie / plesk-tips
Last active August 29, 2015 13:58
For 11.5.x
# Get admin password
/opt/psa/bin/admin --show-password
# Login to mysql
mysql -uadmin -p`cat /etc/psa/.psa.shadow`
@datawebbie
datawebbie / twitter-profile
Created April 9, 2014 13:59
Optimal image size
profile image: 400 x 400
header image: 1500 x 500