Skip to content

Instantly share code, notes, and snippets.

Avatar

Brian Barnett brian3kb

View GitHub Profile
@brian3kb
brian3kb / APACHE: .htaccess pushstate
Created Jan 18, 2017 — forked from rayfranco/APACHE: .htaccess pushstate
.htaccess for HTML5 Pushstate support
View APACHE: .htaccess pushstate
<ifModule mod_rewrite.c>
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.html
</ifModule>
View MCR FRED in CSS.markdown
@brian3kb
brian3kb / Sencha ExtJS 4.x, 5.x, 6.x Currency Component Field.markdown
Last active Apr 4, 2017
Sencha ExtJS 4.x, 5.x, 6.x Currency Component Field
View Sencha ExtJS 4.x, 5.x, 6.x Currency Component Field.markdown

Sencha ExtJS 4.x, 5.x, 6.x Currency Component Field

A simple custom Sencha ExtJS 4.x, 5.x, 6.x component to show correctly formatted currency values on an input box with increment/decrement spinner. Has the xtype 'currencyfield'. When the user is editing the value, the currency symbol is hidden until the edit is complete.

A Pen by Brian Barnett on CodePen.

License.

@brian3kb
brian3kb / ChanceJSUKPhoneNumbers.js
Last active Aug 29, 2015
ChanceJS UK Phone Numbers
View ChanceJSUKPhoneNumbers.js
/*
ChanceJS (http://chancejs.com) doesn't do UK phone numbers, but you can get close by using chance.string with a
pool of numbers 0-9 and length 9, then running it through replace with a bit of regex and
adding a 01 for landline or a 07 for mobiles that will come out correctly formatted with spaces.
Not perfect, and most numbers not real, but it looks better than the US numbers when testing.
*/
var contactNumbers = {
telephone: chance.string({pool: '0123456789', length: 9}).replace(/(\d{2})(\d{3})/g, "01$1 $2 "),
mobile: chance.string({pool: '0123456789', length: 9}).replace(/(\d{2})(\d{3})/g, "07$1 $2 ")
};
@brian3kb
brian3kb / Ext4QuickTips.js
Last active Dec 23, 2015
Add quicktips to extjs 4 form elements and mark required elements with a red asterisk and the text 'required' in the qtip text body.
View Ext4QuickTips.js
/*Call this method after the form has rendered, so either on the afterrender event, or from within a
method bound to that or a similar event that is fired after the form/component has rendered.
Pass the name/id of the form in a way that can be accessed using an ext component query.
In your view/form items array, for each element that you want to have a quicktip, set the property
qtip: 'your tooltip text here.'
If you want the required asterisk and text, set the property allowBlank: false
e.g.