Skip to content

Instantly share code, notes, and snippets.

View mitchkramez's full-sized avatar

Mitch Kramer mitchkramez

View GitHub Profile
@allanemerson
allanemerson / equalize-heights.js
Last active November 30, 2018 20:54
Equalize heights
/*
Usage:
equalizeHeights($('.your-target'));
Note: $w = $(window); and breakpoints = {}; defined elsewhere.
*/
var equalizeHeights = function($elements){
if( !$elements.length ) return;
@jeffersonmartin
jeffersonmartin / composer-private-package-github-token.md
Last active July 25, 2024 09:25
Generate a GitHub Personal Access Token for Private Composer Packages

Generate a GitHub Personal Access Token for Private Composer Packages

If you're trying to load a private repository with Composer/Laravel, we'll need to generate a GitHub Personal Access Token (similar to OAuth token) to access the repository during a composer install without entering credentials.

If you have used other Github packages from {my-org} before, you may be able to skip this step.

  1. Visit https://github.com/settings/tokens.

  2. Click Generate new token.

@a-vasyliev
a-vasyliev / example.com.conf
Created March 25, 2015 11:42
Nginx: proxy cache without utm_* parameters (remove query parameter, remove utm tags nginx)
server {
listen 443;
server_name example.com;
error_log /var/log/nginx/example_com_error.log warn;
ssl on;
ssl_certificate /etc/nginx/ssl/your.crt; #certificate chains
ssl_certificate_key /etc/nginx/ssl/your.key; #private key
@Michael-Brooks
Michael-Brooks / passwordValidation.php
Last active July 7, 2024 03:44
Laravel Password validation Regex (Contain at least one uppercase/lowercase letters and one number)
<?php
/*
* Place this with the rest of your rules.
* Doesn't need to be in an array as there are no pipes.
* Password is required with a minimum of 6 characters
* Should have at least 1 lowercase AND 1 uppercase AND 1 number
*/
$rules = [
'password' => 'required|min:6|regex:/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).+$/'
];

Magento Snippets

Set all categories to is_anchor 1

Find attribute_id

SELECT * FROM eav_attribute where attribute_code = 'is_anchor'

Update all of them with anchor_id from above (usually is ID 51)

UPDATE `catalog_category_entity_int` set value = 1 where attribute_id = 51
@petemcw
petemcw / 01-README.md
Last active February 2, 2024 11:50
Mac OS X LEMP Configuration

Mac OS X LEMP Configuration

This Gist is a collection of configuration files that can be used to easily setup a Homebrew-based LEMP stack on Mac OS X.

Files in this repository are numbered and named for ordering purposes only. At the top of each file is a section of metadata that denote what component the file belongs to and the default name & location of the file. Feel free to implement it however you want.

Note: some configuration files have hard-coded paths to my user directory -- fix it for your setup

Setup

@mitchkramez
mitchkramez / vhost.conf
Last active December 15, 2015 06:19
Ignore HTTP Auth for a Specific IP (vhost.conf)
# Put this in the vhost.conf... otherwise remove the directory wrappers when using as an htaccess... but use it in the vhost.conf, not the htaccess.
# Allow traffic from IP without login
SetEnvIf Remote_Addr ^11\.11\.11\.11$ MOVE_ALONG=true
# Allow traffic from any iPhone user agent without login
SetEnvIfNoCase User-Agent iPhone MOVE_ALONG=true
<Directory "/var/www/vhosts/vhost.com/httpdocs">
Satisfy Any
Order deny,allow
@molotovbliss
molotovbliss / gist:2562551
Last active September 7, 2022 20:18 — forked from davidalexander/gist:1086455
Magento Snippets

Magento Snippets

Set all categories to is_anchor 1

Find attribute_id

SELECT * FROM eav_attribute where attribute_code = 'is_anchor'

Update all of them with anchor_id from above (usually is ID 51)

UPDATE `catalog_category_entity_int` set value = 1 where attribute_id = 51
@mitchkramez
mitchkramez / array_columns.php
Created January 17, 2012 15:32
sort an array for output in columns
/**
* function: array_columns
* author: Brecht Cloetens
* params: $a = array() // original array
* $c = int() // number of columns
*/
function array_columns(&$a, $c=2)
{
$m = ceil(count($a)/$c);
$j = 0;
@claylo
claylo / cf-invalidate.php
Created June 5, 2011 17:09
How to invalidate items in AWS CloudFront
<?php
/**
* Super-simple AWS CloudFront Invalidation Script
*
* Steps:
* 1. Set your AWS access_key
* 2. Set your AWS secret_key
* 3. Set your CloudFront Distribution ID
* 4. Define the batch of paths to invalidate
* 5. Run it on the command-line with: php cf-invalidate.php