Skip to content

Instantly share code, notes, and snippets.

View jasondavis's full-sized avatar

Jason Davis jasondavis

View GitHub Profile
# Make a local copy
service mysql stop
cp -ra /var/lib/mysql mysqldata
service mysql start
# Make a local dump
mysqldump --routines --events --flush-privileges --all-databases > all-databases.sql
# drop everything except the mysql table
mysql -e "SELECT DISTINCT CONCAT ('DROP DATABASE ',TABLE_SCHEMA,' ;') FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA <> 'mysql' AND TABLE_SCHEMA <> 'information_schema';" | tail -n+2 > drop.sql
@pankajparashar-zz
pankajparashar-zz / todo.sh
Created February 8, 2014 07:43
The best todo list app for any developer
Make a list of your todos in /etc/motd:
* Dump prod.sql
- Don't forget to sanitize
* Finish Foo project
And now you'll see it every time you open a new prompt:
* Dump prod.sql
- Don't forget to sanitize
@potar
potar / radiobutton.js
Last active August 29, 2015 14:00
Modified 'radiolist'. Requires x-editable. Adds 'radiolist' option to x-editable where you can use radio inputs.
/**
* The idea was taken here https://github.com/vitalets/x-editable/issues/153
*
* We need to remove this code in the future because this functionality ('radiolist')
* will be in x-editable by default.
*
* You can use only json as a `source`:
* $('.editable-earn-method').editable({
* name: 'earn_method',
* source: {'1': 'Yes', '0': 'No'},
@elchele
elchele / subpanel-list.js
Created August 20, 2014 21:20
Custom controller for suppressing "edit" button functionality on Calls subpanel
({
/* Author: Angel Magaña -- cheleguanaco@cheleguanaco.com
* File: ./custom/clients/base/views/subpanel-list/subpanel-list.js
*
* Extended Subpanel List controller to suppress "Edit" functionality
* on "Calls" subpanel throughout Sugar (Sugar 7.2+)
*
*/
extendsFrom: 'SubpanelListView',
@jasondavis
jasondavis / CSS-Selectors.md
Created September 7, 2014 03:08
CSS Selectors
Pattern
 </th><th class="meaning">Meaning

 </th><th class="described">Described in section

First defined in CSS level

@jasondavis
jasondavis / Markdown-cheatsheet.md
Last active August 29, 2015 14:06 — forked from pankajparashar-zz/cheatsheet.md
MarkDown Cheatsheet
#!/bin/bash
#
# A wrapper arround composer to make it possible to annotate your composer.json file
#
# ## Installation
#
# 1) Install composer globally:
# - composer global require composer/composer @dev
# 2) Create a /usr/bin/composer file with the content of this file
for t in $(mysql -NBA -D <database_name> -e 'show tables')
do
echo "DUMPING TABLE: $t"
mysqldump <database_name> $t | gzip > <some_dir>/$t.sql.gz
done
<?php
class Opportunities {
public function __construct() {
# Instantiate this so we can read all of our resources into RAM ONCE
$this->generator = new OpportunityGenerator();
}
public function populateForAccount(&$account) {
# Need our demo array

HTML5 custom data attributes jQuery plugin

This plugin simplifies the use of HTML5 custom data attributes in your jQuery code. It adds a function named .dataAttr() to the jQuery namespace, which acts as a wrapper for jQuery.attr().

Example Usage

HTML