Skip to content

Instantly share code, notes, and snippets.

@CrookedNumber
CrookedNumber / gist:4076643
Created November 15, 2012 04:28
memcahce stats via drush
drush php-eval '$m =memcache_connect("localhost", 11211); print_r($m->getStats());'
@CrookedNumber
CrookedNumber / gist:5213522
Created March 21, 2013 14:38
Bump PHP memory then test
ini_set('memory_limit','2048M');
dpm(ini_get('memory_limit'));
@CrookedNumber
CrookedNumber / clear cache_field bin
Created March 29, 2013 18:58
clear cache_field bin
cache_clear_all('*', 'cache_field', TRUE);
foreach($_SERVER as $key => $value){
echo "".$key.' - '.$value."<br>";
}
@CrookedNumber
CrookedNumber / gist:6127589
Created August 1, 2013 00:48
make it editable
Reminder: Typing document.body.contentEditable = true; into DevTools makes *all* of the text on a page editable. Useful for prototyping
@CrookedNumber
CrookedNumber / gist:6152911
Last active December 20, 2015 15:18
Spicy Peanut Dressing
Spicy Peanut Dressing
1/3 cup natural peanut butter
1/3 cup rice wine vinegar
2 tablespoons soy sauce
2 tablespoons (packed) brown sugar
1 tablespoon Sriracha
1 large garlic clove, pressed
@CrookedNumber
CrookedNumber / gist:6343955
Created August 26, 2013 17:10
MAMP kill all mysql
killall -9 mysqld
function composer_fix_music_programs() {
$use_composer2_data = variable_get('pi_guide_use_composer2_data');
if ($use_composer2_data) {
$music_program_nids = composer_get_nids_of_music_programs();
foreach ($music_program_nids as $music_program_nid) {
$music_program_node = node_load($music_program_nid);
$music_program_node->field_display_playlist_block['und'][0]['value'] = '1';
@CrookedNumber
CrookedNumber / gist:8856939
Last active September 12, 2022 17:33
How to create Trello Cards from the Command Line (with a ~10 minute set-up)
  1. This is quick and dirty and not terribly maintainable. But it's very useful for creating quick cards from the terminal. Requires familiarity with Trello and a basic understanding of bash.
  2. Log-in to Trello.
  3. Go to: https://trello.com/1/appKey/generate
  4. Make note of your key. Replace any mention of YourTrelloKey with this hash.
  5. Create a token. Go to https://trello.com/1/authorize?key=YourTrelloKey&name=SimpleBASHScript&expiration=never&response_type=token&scope=read,write in your browser and follow directions.
  6. Make note of the token. Replace any mention of YourTrelloToken with this looong hash.
  7. Pick a reasonable number of the most popular boards you use. Grab the URLs of those boards. At the same time, think of short, one-word, easy-to-remember names for each board (e.g., work, homeprojects, wedding).
  8. Grab the board IDs of the boards you chose. It'll be the ~8 character hash-like string in the URL. E.g., for https://trello.com/b/aWsGTrsD/work the ID is aWsGTrsD
  9. One by one, plug thos
@CrookedNumber
CrookedNumber / trello
Last active November 16, 2020 17:36
Sample bash script to add tickets to Trello
#!/bin/bash
if [ $# -ne 2 ]
then
echo "Usage is: $0: <board> <title>"
echo "For example: trello wedding 'Taste cakes'"
exit 1
fi
if [ $1 != 'work' -a $1 != 'homeprojects' -a $1 != 'wedding' ]