Skip to content

Instantly share code, notes, and snippets.

View johnyaucc's full-sized avatar

John Yau johnyaucc

  • BeansBox Studio Limited
  • Hong Kong
View GitHub Profile
@johnyaucc
johnyaucc / drupal-image.php
Created September 10, 2018 08:04 — forked from colorfield/drupal-image.php
Drupal 7 and 8 theme image
<?php
/**
* Drupal 7
*/
$fid = 1;
$uri = file_load($fid)->uri; // or fetched via the uri property of a field
$image_url = image_style_url('thumbnail', $uri);
$image = theme_image(array(
'path' => $image_url,
@johnyaucc
johnyaucc / gist:0ca7de48fa09c8f641faae4ccea1044e
Created August 16, 2016 08:39 — forked from tonymtz/gist:d75101d9bdf764c890ef
Uninstall nodejs from OSX Yosemite
# first:
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following:
# go to /usr/local/lib and delete any node and node_modules
cd /usr/local/lib
sudo rm -rf node*
@johnyaucc
johnyaucc / GitRepoUpdateTimestamp.sh
Created June 29, 2016 06:06 — forked from jeffery/GitRepoUpdateTimestamp.sh
Update Timestamp of files in Checked-out Git Repository
#!/bin/bash -e
####
# Helper script to update the Last modified timestamp of files in a Git SCM
# Projects working Copy
#
# When you clone a Git repository, it sets the timestamp of all the files to the
# time when you cloned the repository.
#
# This becomes a problem when you want the cloned repository, which is part of a
# Web application have a proper cacheing mechanism so that it can re-cache files
@johnyaucc
johnyaucc / Sass-Compass-LiveReload-via-Guard.md
Last active December 21, 2015 22:29 — forked from dvessel/README.mdown
Sass + Compass with LiveReload via Guard

This will enable Sass+Compass with LiveReload through Guard. (Guard screen cast)

You will also need a browser component to communicate with LiveReload. (browser extension, livereload.js)

If you prefer going through a GUI, that option is available. The following instructions is specific to Mac OS X and it works through the command line.

Note that this is not specific to Rails projects. This can work for any standalone front-end project.

Instructions