Skip to content

Instantly share code, notes, and snippets.

View leokoo's full-sized avatar

Leo Koo leokoo

View GitHub Profile
@leokoo
leokoo / WindowsSetup.md
Created October 28, 2017 09:01 — forked from valeryan/WindowsSetup.md
Local WSL Setup

Windows Development Environment Setup

This document outlines the steps I take to setup my environment on windows using WSL. This requires being on the windows 10 Creative update or greater with Ubuntu 16 installed as WSL.

Windows Setup

  1. Install WSL
  2. Install Terminus and setup to use bash for windows.
  3. Install Acrylic DNS Proxy
  4. Download WSL Startup Scripts
  5. Install Xming (optional)
@leokoo
leokoo / Gulpfile.js
Created July 4, 2017 10:57 — forked from laracasts/Gulpfile.js
PHPSpec auto-testing Gulpfile
var gulp = require('gulp');
var phpspec = require('gulp-phpspec');
var run = require('gulp-run');
var notify = require('gulp-notify');
gulp.task('test', function() {
gulp.src('spec/**/*.php')
.pipe(run('clear'))
.pipe(phpspec('', { notify: true }))
.on('error', notify.onError({
@leokoo
leokoo / fix-homebrew-npm.md
Created June 30, 2017 19:12 — forked from DanHerbert/fix-homebrew-npm.md
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

Solution

This solution fixes the error caused by trying to run npm update npm -g. Once you're finished, you also won't need to use sudo to install npm modules globally.

Before you start, make a note of any globally installed npm packages. These instructions will have you remove all of those packages. After you're finished you'll need to re-install them.

https://gist.github.com/studiopress/4a55a5e7299d80eecd64#file-digital-pro-front-page-3-text-widget-2-html
https://gist.github.com/studiopress/a7080976204fbccd4dbe#file-digital-pro-front-page-3-text-widget-3-html
https://gist.github.com/studiopress/2a7b1cb75d4966d7ff83#file-digital-pro-front-page-3-text-widget-4-html
# Footer for theme
https://gist.github.com/studiopress/5700192#file-credits-2-php
# User Profile
https://gist.github.com/studiopress/cf2b8c98bdf1d769c4f2#file-digital-pro-user-profile-html
function lenscap_list_cats( $type ='grid' ) {
global $post;
$terms = get_the_terms( $post->ID, array( 'category', 'rating') );
if ( $terms ) {
echo '<div class=" '. $type . '-cats">';
// Here's the main error
foreach( $terms as $term ) {
function lenscap_list_cats( $type ='grid' ) {
global $post;
$terms = get_the_terms( $post->ID, array( 'category', 'rating') );
if ( $terms ) {
echo '<div class=" '. $type . '-cats">';
// Here's the main error
foreach( $terms as $term ) {

In this article I'm going to walk you through process of creating Wordpress plugins. First I'm going to talk about some of the basic concepts in Wordpress plugin development like the actions, hooks, and API's that makes up Wordpress. Then were going to build a plugin where we apply some of the concepts and best practices in developing Wordpress plugins.

###Prerequisites

In order to fully benefit from this tutorial you should have a basic knowledge on PHP. As Wordpress is running on PHP and most of the code that we will be writing will be on PHP. A little bit of knowledge on HTML, CSS and JavaScript is also helpful but not required for this tutorial.

@leokoo
leokoo / freecodecamp-test.markdown
Created October 2, 2016 16:31
FreeCodeCamp - Test
@leokoo
leokoo / .bash_profile
Created May 18, 2016 23:48 — forked from natelandau/.bash_profile
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@leokoo
leokoo / racer_utils.rb
Last active November 15, 2015 04:09 — forked from nextacademy-private/racer_utils.rb
R-r-r-r-r-ruby Racer!
class Die
def initialize(sides = 6)
@sides = sides
end
# Remember: rand(N) randomly returns one of N consecutive integers, starting at 0
# So rand(N) returns a random integer in (0..N-1)
# And 1 + rand(N) returns a random integer in (1..N)
# See: http://www.ruby-doc.org/core-1.9.3/Kernel.html#method-i-rand
def roll