Skip to content

Instantly share code, notes, and snippets.

@robinvdvleuten
robinvdvleuten / wp-config.php
Created February 2, 2012 10:45
Multiple configuration files with Wordpress
<?php
/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
/** Load configuration based on the server's environment **/
$env = isset($_SERVER['ENVIRONMENT']) ? $_SERVER['ENVIRONMENT'] : 'dev';
require_once ABSPATH . 'wp-config/wp-config.' . strtolower($env) . '.php';
/** Sets up WordPress vars and included files. */
@ashfame
ashfame / awesome-wp-config-file.php
Created February 27, 2012 13:30
awesome-wp-config-file
<?php
/**
* Define type of server
*
* Depending on the type other stuff can be configured
* Note: Define them all, don't skip one if other is already defined
*/
define( 'DB_CREDENTIALS_PATH', dirname( ABSPATH ) ); // cache it for multiple use
@ashfame
ashfame / local-config-awesome-wp-config-file.php
Created February 27, 2012 13:34
Local config file to hold db credentials and for defining keys & salts along with the use of awesome wp-config.php file
<?php
/**
* WordPress config file to use one directory above WordPress root, when awesome version of wp-config.php is in use.
*
* Awesome wp-config.php file - https://gist.github.com/1923821
*/
/* WordPress Local Environment DB credentials */
@jaygooby
jaygooby / gist:2170045
Created March 23, 2012 12:02
Replacing text nodes http://stackoverflow.com/a/1175796/391826 patched for MSIE
function htmlreplace(a, b, element) {
if (!element) element = document.body;
var nodes = element.childNodes;
for (var n=0; n<nodes.length; n++) {
// MSIE doesn't have Node
if (nodes[n].nodeType == 3) {
var r = new RegExp(a, 'gi');
// MSIE8 and less doesn't have textContent
if (nodes[n].textContent) {
@endolith
endolith / Accent.py
Last active November 19, 2023 00:09
Documenting the matplotlib colormaps
# https://github.com/matplotlib/matplotlib/issues/881
# Several of the ColorBrewer maps are "qualitative", meaning
# they are just a group of colors that can be used together
# for categories of data. So I remapped Accent to segments
# instead of continuous:
# Actually, these should be used with ListedColormap, and
# the number of colors should depend on the number of
# categories in the data, with colors removed from the
# list in a certain order?
@ttscoff
ttscoff / brettquix.txt
Created May 23, 2012 02:32
Brett's Quix File
@Brett's searches
@Brett's custom searches
go https://duckduckgo.com/?q=%21%20%s Open first result (DuckDuckGo)
b https://duckduckgo.com/?q=%21%s Bang search (DuckDuckGo)
grep https://www.cueup.com/?q=%s&fq=1 Greplin
ss https://duckduckgo.com/site:%d%20%s Current site (DuckDuckGo)
bt https://duckduckgo.com/site:brettterpstra.com%20%s BrettTerpstra.com (DuckDuckGo)
gh http://github.com/search?q=%s&type=Everything&repo=&langOverride=&start_value=1 Search GitHub (everything)
hints http://hints.macworld.com/search.php?query=%s&keyType=all&datestart=&dateend=&topic=0&type=stories&results=50&mode=search Search Mac OS X Hints
mu http://www.macupdate.com/find/mac/%s Search MacUpdate (Software)
@lsauer
lsauer / jscopy.css
Created May 30, 2012 13:37
Copy to the clipboard in JavaScript, securely and without Flash
a{ cursor:pointer; }
a, a:link {
background-color: #eee; /*#407EC9*/
border-radius:5px;
padding:0px 2px 0px 2px;
color: #666;
font-weight: none;
text-decoration: none;
opacity:.7;
}
@amejiarosario
amejiarosario / rails_activerecord_cheatsheet.md
Created June 18, 2012 22:18
Rails ActiveRecord (association) - Cheatsheet

Rails ActiveRecord (association) - Cheatsheet

http://guides.rubyonrails.org/association_basics.html

Types of associations

  • belongs_to : TABLE_NAME
  • has_one : TABLE_NAME [:through => :TABLE_NAME]
  • has_many : TABLE_NAME [:through => :TABLE_NAME]
  • has_and_belongs_to_many : TABLE_NAME [:join_table => :TABLE_NAME]
@tuzz
tuzz / github.css
Last active May 8, 2024 00:48
Github Markdown Stylesheet
/*
Copyright (c) 2017 Chris Patuzzo
https://twitter.com/chrispatuzzo
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@jasonferrier
jasonferrier / wp-config.php
Last active October 10, 2015 03:27
Wordpress auto-config for dev/test/live environments
<?php
/**
* The base configurations of the WordPress.
*
* This file has the following configurations: MySQL settings, Table Prefix,
* Secret Keys, WordPress Language, and ABSPATH. You can find more information
* by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
* wp-config.php} Codex page. You can get the MySQL settings from your web host.
*
* This file is used by the wp-config.php creation script during the