Skip to content

Instantly share code, notes, and snippets.

@chrismccoy
chrismccoy / gitcheats.txt
Last active April 20, 2024 08:50
git cheats
# alias to edit commit messages without using rebase interactive
# example: git reword commithash message
reword = "!f() {\n GIT_SEQUENCE_EDITOR=\"sed -i 1s/^pick/reword/\" GIT_EDITOR=\"printf \\\"%s\\n\\\" \\\"$2\\\" >\" git rebase -i \"$1^\";\n git push -f;\n}; f"
# edit all commit messages
git rebase -i --root
# clone all your repos with gh cli tool
gh repo list --json name -q '.[].name' | xargs -n1 gh repo clone
@harshamv
harshamv / url_slug.php
Created January 5, 2013 06:17
Generate URL Slug for CakePHP
// Creates a URL Slug
function _url_slug($string) {
$string = strtolower(trim($string));
$string = preg_replace('/[^a-z0-9-]/', '-', $string);
$string = preg_replace('/-+/', "-", $string);
return $string;
}
// Gets a Unique slug string by checking in the database
@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active April 26, 2024 23:26 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.
@og-shawn-crigger
og-shawn-crigger / ci_uri_info.md
Created April 7, 2012 06:41
CodeIgniter Snippets - How to get Controller, Method and Module name - Router | URI Classes

CodeIgniter - Working with URL Params

Target a Specific Value

$this->uri->segment(n); // n=1 for controller, n=2 for method, etc

Using the Router Class

@og-shawn-crigger
og-shawn-crigger / MY_Config.php
Created October 30, 2011 01:02
Start of reading/writing Config Options From Database
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Config extends CI_Config {
public function database()
{
if (function_exists('get_instance'))
{
$CI =& get_instance();
$query = $CI->db->get('config');