Skip to content

Instantly share code, notes, and snippets.

View malinky's full-sized avatar

Craig Ramsay malinky

View GitHub Profile
@malinky
malinky / gist:a99aca8f0f0b346ed1477a45c92ad4ad
Created April 18, 2016 07:58
Update WordPress plugin in plugin directory
# CD into local directory of files (Or checkout if don't have).
cd my-local-dir/
# Check it's up to date.
svn up
# Make changes to the files in the trunk directory then check them against the remote.
# Files are flagged with M for modified.
svn stat
@malinky
malinky / vueify.sublime-snippet
Last active April 14, 2016 16:17
Sublime snippet for a Vueify based component.
<snippet>
<content><![CDATA[
<template>
</template>
<script>
export default {
data () {
return {
}
#Saved at /usr/local/lib
# cd /usr/local/lib
# List globally installed packages
npm list -g --depth 0
# List outdated globally installed packages
npm outdated -g --depth 0
# Update globally installed package
@malinky
malinky / gist:93970f2c64099194dc95
Created March 3, 2016 09:24
Add // to URL if missing either http:// or https:// (Example using Blade)
<a href="{{ preg_replace('/^(?!https?:\/\/)/', '//', $supplier->website) }}">Website</a>
@malinky
malinky / gist:f5c628f4a2c86efa026f
Created September 9, 2015 10:37
Wordpress Plugin SVN
# Checkout (Don't need LOCAL-DIR if already in it)
svn co https://plugins.svn.wordpress.org/PLUGIN-NAME/ LOCAL-DIR
# Let svn know about new files ready for a commit (after adding the actual files to the local directory)
# Don't need this if amending an exists versioned file
svn add DIR/*
svn add DIR/FILENAME
@malinky
malinky / gist:596d49c504eb4db8e600
Last active August 29, 2015 14:22
Install Composer and Laravel
# Install composer. Moving to /usr/local/bin/composer means it can now be run as composer COMMAND rather php composer.phar COMMAND
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
# Download Laravel installer.
composer global require "laravel/installer=~1.1"
# Add to $PATH https://gist.github.com/malinky/e7fb7e4a757c4bbd5acc
@malinky
malinky / gist:93d68435fb32bb19051d
Created February 26, 2015 09:00
Magento DB Import
/* Add the below to the start and then end .sql file */
SET foreign_key_checks = 0;
SET foreign_key_checks = 1;
@malinky
malinky / gist:d3b24632010b87d8fb3e
Created February 12, 2015 13:43
CSS3 Transform Scale
/*
* 1. Stop image blurring on scale.
*/
img {
transition: transform 0.15s ease-in-out;
backface-visibility: hidden; /* 1 */
transform: translateZ(0); /* 1 */
}
img:hover {
@malinky
malinky / gist:bff000432a1551085447
Created February 12, 2015 10:06
Wordpress DB Cleanup
/* Delete revisions */
DELETE FROM wp_posts WHERE post_type = "revision";
/**
* Also set in wp-config.php
* define( 'WP_POST_REVISIONS', 3 );
*/
/* Clean postmeta where the associated post no longer exists */
SELECT * FROM wp_postmeta pm LEFT JOIN wp_posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL;
@malinky
malinky / gist:2bf6430cd6deedee4ff8
Last active August 29, 2015 14:14
Function Declarations and Expressions
/**
* See http://benalman.com/news/2010/11/immediately-invoked-function-expression/ for a better explanation
*/
<script>
function test() {
console.log('function declaration that is called with test()');
}
test();
(function test() {
console.log('immediately invoked function declaration wrapped in brackets (turned into an expression)');