Skip to content

Instantly share code, notes, and snippets.

View leek's full-sized avatar

Chris Jones leek

View GitHub Profile
@leek
leek / homestead.md
Last active September 16, 2022 21:39
Instructions for setting up and using Homestead

Homestead Setup

  1. (Mac Only) Install Homebrew:

     /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    
  2. (Mac Only) Install Caskroom:

     brew tap caskroom/cask
    
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class ConfigServiceProvider extends ServiceProvider
{
/**
* Overwrite any vendor / package configuration.
@leek
leek / fizzbuzz.js
Created September 9, 2014 06:58
FizzBuzz solutions in various languages.
for (var i = 1; i <= 100; i++) {
if (i % 15 === 0) {
console.log('FizzBuzz');
} else if (i % 3 === 0) {
console.log('Fizz');
} else if (i % 5 === 0) {
console.log('Buzz');
} else {
console.log(i);
}

Includes:

  • Configuration
  • BrowserSync
  • Environments (e.g.,: --environment=production)
  • Image optimization (gif, jpg, png, and svg)
  • Sass compilation with external libraries
  • Bower installed Sass libraries example(s)
  • CSS processing with Pleeease
/**
* Disable and enable event on scroll begin and scroll end.
* @see http://www.thecssninja.com/javascript/pointer-events-60fps
*/
(function(r, t) {
window.addEventListener('scroll', function() {
// User scrolling so stop the timeout
clearTimeout(t);
// Pointer events has not already been disabled.
if (!r.style.pointerEvents) {
<?php
namespace app\controllers;
use app\models\Downloads;
class DownloadsController extends \lithium\action\Controller {
public function index() {
$this->request->privateKeys = array('id', 'user_id');
@leek
leek / reset_permissions.sh
Created September 30, 2013 15:50
Magento - Simple reset file permissions script
#!/bin/bash
#
# Found on StackOverflow:
# http://stackoverflow.com/a/9304264/3765
#
if [ ! -f ./app/etc/local.xml.template ]; then
echo "-- ERROR"
echo "-- This doesn't look like a Magento install. Please make sure"
echo "-- that you are running this from the Magento main doc root dir"
@leek
leek / magento_urls.sql
Created July 8, 2013 21:53
Magento: Fix Hardcoded URL's in Database
UPDATE cms_block SET content = REPLACE(content, "http://www.example.com/", "{{store url=''}}");
UPDATE cms_page SET content = REPLACE(content, "http://www.example.com/", "{{store url=''}}");
--
-- AW_Blog Only
--
UPDATE aw_blog SET post_content = REPLACE(post_content, 'http://www.example.com/', "{{store url=''}}");
@leek
leek / WritingMagentoModules.md
Created July 8, 2013 21:51
Writing Modules for Magento 1.x

Writing Magento Modules

All custom modules should have a Namespace and Module Name. These are used below as {Namespace} and {Module}.

Caution: The Magento autoloader is known to have problems with CamelCase namespaces and/or modules between Windows and *nix systems. If your module requires more than one word for either of these, it is best to just concatenate them to avoid any issues (Example: {Namespace}_{Examplemodule}).

Index

#!/bin/bash
set -o errexit
# Author: David Underhill
# Script to permanently delete files/folders from your git repository. To use
# it, cd to your repository's root and then run the script with a list of paths
# you want to delete, e.g., git-delete-history path1 path2
if [ $# -eq 0 ]; then
exit 0