Skip to content

Instantly share code, notes, and snippets.

@fragje
fragje / my.cnf
Created April 3, 2014 13:07
Custom my.cnf for use with MAMP. Place this file in `/Application/MAMP/conf/` and restart MAMP
# Example MySQL config file for large systems.
#
# This is for a large system with memory = 512M where the system runs mainly
# MySQL.
#
# MySQL programs look for option files in a set of
# locations which depend on the deployment platform.
# You can copy this option file to one of those
# locations. For information about these locations, see:
# http://dev.mysql.com/doc/mysql/en/option-files.html
@nobodyplace
nobodyplace / gist:9571024
Created March 15, 2014 17:39
hotkeys-sample-keypress-3
//return key
$(document).bind('keypress', 'return', function (evt){
alert('pressed enter/return key');
});
//esc key
$(document).bind('keypress', 'esc', function (evt){
alert('pressed ESC key');
});
@nobodyplace
nobodyplace / gist:9570888
Last active November 20, 2015 15:54
hotkeys-sample-keypress-2
$('#sample').bind('keypress', 'j', function (evt){
alert('pressed J key');
});
@saltednut
saltednut / remove-web-tools.sh
Last active February 10, 2020 13:00
Remove MySQL and turn off Apache in OSX
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
rm -rf ~/Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /var/db/receipts/com.mysql.*
@kostajh
kostajh / setup.py
Last active December 31, 2015 12:59
Call with something like `python3 setup.py --username ACQUIA_CLOUD_USERNAME --password ACQUIA_CLOUD_PASSWORD --branch GIT_BRANCH`
#!/usr/bin/env python3
import subprocess
import json
import time
import sys
import argparse
baseurl = 'https://cloudapi.acquia.com/v1/sites/devcloud:MYSITE'
parser = argparse.ArgumentParser(description='Get username and password.')
@apauly
apauly / gist:7917906
Last active May 4, 2016 06:00
Mixin for responsive sprites with Sass
@mixin responsive-sprite($map, $icon){
$icon-file: sprite-file($map, $icon);
$icon-width: image-width($icon-file);
$icon-height: image-height($icon-file);
$sprite-file: sprite-path($map);
$sprite-width: image-width($sprite-file);
$sprite-height: image-height($sprite-file);
$space-top: floor(nth(sprite-position($map, $icon), 2));
@azet
azet / apache_PFS_TLS_setup
Last active December 20, 2015 14:08
Perfect Forward Secrecy/TLS Setup with Apache 2.4 / OpenSSL 1.0.1e on Debian Wheezy
### _/IMPORTANT NOTE_/
### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
### i really prefer ruby, python, C, sh, pgsql or whatever. but this was done for a DIY project, so
### please do not flame on the mariadb and php5 installation, thats not whats important here anyways.
###
### if i forgot someting, please drop me a line instantly via: Mail: azet@azet.org (GPG prefered) or
### via XMPP (OTR prefered): azet@jabber.ccc.de - see also: www.azet.org / https://twitter.com/a_z_e_t
###
### as always, of course: this is public domain knowledge. no warranties.
### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
<?php
/**
* This file will demonstrate a method to export fields to code.
* You can use this to easily create fields using the UI, export to code
* and then use in a custom module. Upon installation of the module
* your fields and instances will already be set up.
*/
// Create the fields you want using the Drupal UI.
// On the same site, go to example.com/devel/php
@jeffam
jeffam / hook_menu_block_blocks
Last active December 18, 2015 17:19
Default Menu Blocks
<?php
/**
* Implements hook_menu_block_blocks().
*/
function sidebar_menu_menu_block_blocks() {
// The array key is the block delta used by menu block.
return array(
'sidebar_subnav' => array(
'title_link' => TRUE,
'admin_title' => 'Current Menu Children',
@juampynr
juampynr / mymodule.info
Last active June 9, 2023 21:53
Drupal 7 Views 3 custom field handler
dependencies[] = ctools
; Views Handlers
files[] = views/mymodule_handler_handlername.inc