Skip to content

Instantly share code, notes, and snippets.

View chrillep's full-sized avatar
🆗
200

Christian Widlund chrillep

🆗
200
View GitHub Profile
@mathewbyrne
mathewbyrne / slugify.js
Created October 12, 2011 04:34
Javascript Slugify
function slugify(text)
{
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@paulc010
paulc010 / tw-wp-post-tags.php
Created March 27, 2012 09:26
Twitter bootstrap+font-awesome buttons for Wordpress post tags
<footer>
<?php
if (get_the_tags()) $posttags = get_the_tags();
if ($posttags) {
$tagging = '';
foreach($posttags as $tag) {
$tagging = $tagging . '<a class="btn btn-action btn-mini" href="?tag='.$tag->slug.'"><i class="icon-tag"></i> '.$tag->name .'</a>'. ' ';
}
}
?>
@denji
denji / nginx-tuning.md
Last active June 21, 2024 15:08
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@natelandau
natelandau / .bash_profile
Last active June 13, 2024 18:01
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
@tobi-pb
tobi-pb / migrate.sh
Last active March 3, 2023 23:34
Upgrade MAMP to Mysql 5.6
#!/bin/sh
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.24-osx10.9-x86_64.tar.gz
tar xfvz mysql-5.6*
echo "stopping mamp"
sudo /Applications/MAMP/bin/stop.sh
sudo killall httpd mysqld
echo "creating backup"
@jaakkolehtonen
jaakkolehtonen / oh-my-zsh-custom-installation.sh
Last active March 19, 2021 00:22
Custom @ohmyzsh installation which keeps ~/.zshrc in sync via @dropbox
# Create hidden folder for Oh My Zsh core installation with subfolders for custom plugins and themes
mkdir -p ~/.zsh/custom/{plugins,themes}
# Clone Oh My Zsh from Github into root of hidden ~/.zsh directory
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.zsh/oh-my-zsh
# Clone Powerlevel9k theme to ~/.zsh/custom/themes folder
git clone https://github.com/bhilburn/powerlevel9k.git ~/.zsh/custom/themes/powerlevel9k
# Fetch and install Nerd Font from Github to be used with our new shell config (http://nerdfonts.com/#downloads), long script but does the job :)
@QWp6t
QWp6t / BedrockMultisiteValetDriver.php
Last active June 17, 2024 07:43
Fix Laravel Valet when using WordPress subdirectory multisite + Bedrock
<?php
namespace Valet\Drivers\Custom;
class BedrockMultisiteValetDriver extends \Valet\Drivers\Specific\BedrockValetDriver
{
/**
* Determine if the incoming request is for a static file.
*
* @return string|false
@rhukster
rhukster / sphp.sh
Last active March 30, 2024 10:41
Easy Brew PHP version switching (Now moved to https://github.com/rhukster/sphp.sh)
#!/bin/bash
# Creator: Phil Cook
# Modified: Andy Miller
#
# >>> IMPORTANT: Moved to: https://github.com/rhukster/sphp.sh
# >>> Kept here for legacy purposes
#
osx_major_version=$(sw_vers -productVersion | cut -d. -f1)
osx_minor_version=$(sw_vers -productVersion | cut -d. -f2)
osx_patch_version=$(sw_vers -productVersion | cut -d. -f3)