Skip to content

Instantly share code, notes, and snippets.

Shane Perera shanecp

View GitHub Profile
@shanecp
shanecp / gist:db18c9fe5889e123d729aa110d5e807a
Created Apr 24, 2019
Freeze Google chrome to inspect the contents
View gist:db18c9fe5889e123d729aa110d5e807a
setTimeout(function(){debugger;}, 5000);
@shanecp
shanecp / Intersect
Created Apr 14, 2019
Recursive Intersect for array subsets in PHP. Pass an array and a subset of an array. Returns the matching subset if it intersects.
View Intersect
<?php
namespace App\Domain;
class Intersect
{
@shanecp
shanecp / domdetailer.php
Created Apr 9, 2018
DomDetailer PHP Code
View domdetailer.php
<?php
$results = [];
if (!empty($_POST['domains'])) {
$apiKey = 'INSERT_API_KEY';
$domains = explode("\n", $_POST['domains']);
foreach ($domains as $domain) {
@shanecp
shanecp / nginx_wordpress_subfolder.md
Last active Dec 22, 2017
nginx Configuration for WordPress subfolders
View nginx_wordpress_subfolder.md

Setup WordPress in nginx within a subfolder. This example does the redirect to a folder called /blog. So you can have one installation at / and another at /blog Change [sitename].dev to the domain.

server {
	listen 80;
	listen [::]:80;
	server_name     [sitename].com.au www.[sitename].com.au;
    	# redirect all http traffic to https
	return          301 https://www.$server_name$request_uri;
@shanecp
shanecp / 0_reuse_code.js
Created Mar 12, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@shanecp
shanecp / error_libsass.md
Created Mar 12, 2016
Error: `libsass` bindings not found. Try reinstalling `node-sass`?
View error_libsass.md

Error: libsass bindings not found. Try reinstalling node-sass?

npm uninstall --save-dev gulp-sass
npm install --save-dev gulp-sass

or try deleting node_modules and running npm install again. The cause of this is a conflict between node + npm + node-sass + gulp-sass.

@shanecp
shanecp / .bash_profile
Created Nov 27, 2015
.bash_profile for Terminal on OSX
View .bash_profile
# @gf3’s Sexy Bash Prompt, inspired by “Extravagant Zsh Prompt”
# Shamelessly copied from https://github.com/gf3/dotfiles
alias a='php artisan'
alias reseed='php artisan migrate:refresh --seed'
alias cept='vendor/bin/codecept'
alias ioios='ionic run ios -l -c'
default_username='shane'
@shanecp
shanecp / git
Created Aug 8, 2015
Clone GIT repo to your current directory
View git
git clone your-repo tmp && mv tmp/.git . && rm -rf tmp && git reset --hard
@shanecp
shanecp / implode.js
Created Mar 31, 2015
LoDash - extension for implode (similar to PHP function)
View implode.js
_.mixin({
implode: function (glue, collection) {
glue = glue || '';
if (!_.isArray(collection)) return false;
if (collection.length == 1) return collection[0];
var returnString = '';
@shanecp
shanecp / gulpfile.js
Last active Jan 9, 2016 — forked from ognjenm/watch.js
Laravel 5 Elixir with LiveReload custom task
View gulpfile.js
// require the file
require('./gulp_tasks/watch');
// Call the new task in Laravel Elixir file
elixir(function(mix)) {
mix.watch();
});
You can’t perform that action at this time.