Skip to content

Instantly share code, notes, and snippets.

View mkormendy's full-sized avatar
🛠️
Building, fixing, making a living

Mike Kormendy mkormendy

🛠️
Building, fixing, making a living
View GitHub Profile
@mkormendy
mkormendy / fix-homebrew-npm.md
Created June 12, 2017 00:15 — 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.

@mkormendy
mkormendy / get-process-progress.sh
Created March 30, 2017 18:54
Terminal command to get process progress
watch lsof -p`pgrep -x cp`
@mkormendy
mkormendy / persistent_multipage_forms-reloaded.php
Created January 20, 2017 23:05 — forked from MikevHoenselaar/persistent_multipage_forms-reloaded.php
Render persistence data before form output changed to work with populated fields.
```php
// Render persistence data before form output
add_filter("gform_pre_render", "ri_pre_populate_the_form");
function ri_pre_populate_the_form($form) {
if (gfdp_is_persistent($form)) {
$current_page = GFFormDisplay::get_current_page($form["id"]);
if ($current_page == 1) {
$option_key = ri_getFormOptionKeyForGF($form);
if (get_option($option_key)) {
$persistent_info = json_decode(get_option($option_key));
@mkormendy
mkormendy / nginx.conf
Created October 24, 2016 21:17 — forked from markjaquith/nginx.conf
My WordPress Nginx setup
upstream phpfpm {
server unix:/var/run/php5-fpm.sock;
}
upstream hhvm {
server unix:/var/run/hhvm/hhvm.sock;
}
# SSL
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
@mkormendy
mkormendy / .htaccess
Created October 21, 2016 23:42 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
osascript -e "tell application \"Finder\" to quit" && defaults write com.apple.finder DisableAllAnimations -bool false && defaults write com.apple.finder AnimateWindowZoom -bool true && defaults write com.apple.finder TotalFinderDontFixInstallerDefaults -bool true
@mkormendy
mkormendy / Object.prototype.watch.js
Created September 8, 2016 16:54 — forked from adriengibrat/Object.prototype.watch.js
Object.prototype.watch "polyfill"
/**
* Object.prototype.watch polyfill
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/watch
*
* Known limitations:
* - `delete object[property]` will remove the watchpoint
*
* Based on Eli Grey gist https://gist.github.com/eligrey/384583
* Impovements based on Xose Lluis gist https://gist.github.com/XoseLluis/4750176
* This version is optimized for minification
@mkormendy
mkormendy / object-watch.js
Created September 8, 2016 16:35 — forked from eligrey/object-watch.js
object.watch polyfill in ES5
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
@mkormendy
mkormendy / var_dump-log.php
Last active July 20, 2016 01:43 — forked from mkolb/var_dump-log.php
var_dump into error log
<?php
ob_start();
var_dump($geo_json);
error_log(ob_get_clean());
?>
@mkormendy
mkormendy / gravity_form_elements.xml
Created July 18, 2016 04:16 — forked from BronsonQuick/gravity_form_elements.xml
If you're using your own Gravity Forms CSS styling then import this xml file into your WordPress site to see if you've styled all of the Gravity Form fields and labels correctly.
<?xml version="1.0" encoding="UTF-8"?>
<forms version="1.6.12">
<form labelPlacement="top_label" useCurrentUserAsAuthor="1">
<title><![CDATA[GF Form 1 Test - Top aligned labels, Descriptions below inputs]]></title>
<description><![CDATA[We would love to hear from you! Please fill out this form and we will get in touch with you shortly.]]></description>
<confirmation type="message">
<message><![CDATA[Thanks for contacting us! We will get in touch with you shortly.]]></message>
</confirmation>
<button type="text">
<text><![CDATA[Submit]]></text>