Skip to content

Instantly share code, notes, and snippets.

@aghuddleston
aghuddleston / PageSize.js
Created March 24, 2014 20:39
Ext JS 4 PageSize plugin from Sencha forums
/**
* Ext.ux.grid.PageSize
* http://www.sencha.com/forum/showthread.php?130787-Ext.ux.toolbar.PagingOptions&p=610981&viewfull=1#post610981
*/
Ext.define('Ext.ux.grid.PageSize', {
extend : 'Ext.form.field.ComboBox',
alias : 'plugin.pagesize',
beforeText : 'Show',
afterText : 'per page',
mode : 'local',
@aghuddleston
aghuddleston / Ext.ux.form.field.DateDisplayField.js
Last active August 29, 2015 13:58
Ext JS 4 extension for a date display field
Ext.define('Ext.ux.form.field.DateDisplayField', {
extend: 'Ext.form.field.Display',
alias: 'widget.datedisplayfield',
datePattern: 'Y-m-d',
valueToRaw: function(value) {
return Ext.util.Format.date(value, this.datePattern);
}
});
@aghuddleston
aghuddleston / Paging.js
Last active August 29, 2015 14:00
Ext JS 4.1.1 paging toolbar override which aligns the paging buttons to the right side of the toolbar
// Ext JS 4.1.1 paging toolbar override which aligns the paging buttons
// to the right side of the toolbar. New config "alignPagingRight" set
// to true will cause the paging buttons to align right.
Ext.define('overrides.toolbar.Paging', {
override: 'Ext.toolbar.Paging',
initComponent : function() {
var me = this,
pagingItems = me.getPagingItems(),
userItems = me.items || me.buttons || [];
@aghuddleston
aghuddleston / Ext.ux.RowExpander.js
Last active August 29, 2015 14:01
Ext JS 4.1.1 RowExpander grid plugin updated to play nicer with checkboxes and clearing all expanded
/**
* @class Ext.ux.RowExpander
* @extends Ext.AbstractPlugin
* Plugin (ptype = 'rowexpander') that adds the ability to have a Column in a grid which enables
* a second row body which expands/contracts. The expand/contract behavior is configurable to react
* on clicking of the column, double click of the row, and/or hitting enter while a row is selected.
*
* @ptype rowexpander
*/
Ext.define('Ext.ux.RowExpander', {
Get the Heroku db as detailed here:
http://devcenter.heroku.com/articles/pgbackups#exporting_via_a_backup
1. heroku pgbackups:capture
2. heroku pgbackups:url <backup_num> #=>backup_url
- get backup_num with cmd "heroku pgbackups"
3. curl -o latest.dump <backup_url>
Then locally do:
$ pg_restore --verbose --clean --no-acl --no-owner -h localhost -U myuser -d mydb latest.dump
@aghuddleston
aghuddleston / brew-install-redis.txt
Created April 29, 2015 13:31
Output from brew install redis, for future reference
/Users/me$ brew install redis
==> Downloading https://homebrew.bintray.com/bottles/redis-3.0.0.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring redis-3.0.0.yosemite.bottle.tar.gz
==> Caveats
To have launchd start redis at login:
ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents
Then to load redis now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
Or, if you don't want/need launchctl, you can just run:
@aghuddleston
aghuddleston / NotifyBar.css
Last active October 4, 2015 02:17
Success or error message notification bar extending from an Ext JS 4.1.0 toolbar.
.notifybar{
margin: 3px !important;
}
.notifybar-success, .x-nlg .notifybar-success {
border: 1px solid #AEE0AE !important;
background-color: #D1EED1 !important;
background-image: none !important;
}
.notifybar-error, .x-nlg .notifybar-error {
border: 1px solid #F79897 !important;
@aghuddleston
aghuddleston / PanelHeaderExtraIcons.js
Last active October 5, 2015 07:18
Ext JS 4.1 Plugin to add items to the right side of a panel header
Ext.define('Ext.ux.panel.header.ExtraIcons', {
extend: 'Ext.AbstractPlugin',
alias: 'plugin.headericons',
alternateClassName: 'Ext.ux.PanelHeaderExtraIcons',
iconCls: '',
index: undefined,
headerButtons: [],
@aghuddleston
aghuddleston / DismissableAlert.css
Created August 6, 2012 19:04
Ext JS 4 Alert, in the Twitter Bootstrap Style
/* CSS originally from http://twitter.github.com/bootstrap/index.html
and modified slightly since the full bootstrap css is not included */
.alert {
padding: 8px 35px 8px 14px;
margin-bottom: 18px;
color: #c09853;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
background-color: #fcf8e3;
border: 1px solid #fbeed5;
@aghuddleston
aghuddleston / RemoteToLocalComboBox.js
Created September 6, 2012 19:47
Ext JS 4 Remote To Local Hybrid ComboBox Plugin
/**
This combo functions as a remote-local ExtJS combo hybrid. It starts out
as a remote combo so that nothing is loaded until the trigger button is clicked
or the user starts typing in the combobox. Once the data is loaded, it switches
to local mode so that no more queries are made to the server. It therefore
assumes that all data is loaded on the first load request. It also shows the
loading UI when data is being loaded since it starts out as 'remote'.
*/
Ext.define("Ext.ux.form.field.RemoteToLocalComboBox", {
extend: 'Ext.AbstractPlugin',