Skip to content

Instantly share code, notes, and snippets.

View jasondavis's full-sized avatar

Jason Davis jasondavis

View GitHub Profile
<?php
class Accounts_logic_hook_class
{
function Accounts_logic_hook_method(&$bean, $event, $arguments)
{
echo "Hit the Accounts before save logic hook";
exit;
}
}
@jasondavis
jasondavis / repair.php
Last active August 29, 2015 14:07 — forked from bickart/repair.php
#!/usr/bin/php
<?php
/*
* Copyright 2013
* Jeff Bickart
* @bickart
* jeff @ neposystems.com
*/
({
/* 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',
<?php
require_once 'include/SugarLogger/SugarLogger.php';
class custom_Company_Helper_Logger extends SugarLogger
{
protected $logfile = 'company_logger';
protected $ext = '.log';
protected $dateFormat = '%c';
protected $logSize = '10MB';
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
# 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

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

@jasondavis
jasondavis / Form2JSON.jquery.js
Created October 20, 2014 11:35
Convert FORM POST into JSON with JavaScript jQuery - JSFiddle
// Convert FORM POST into JSON with JavaScript jQuery - JSFiddle
//
// http://jsfiddle.net/jasondavis/qj35st8d/
//
//
//
$.fn.serializeObject = function()
{
@jasondavis
jasondavis / javascript_resources.md
Last active August 29, 2015 14:08 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage