Skip to content

Instantly share code, notes, and snippets.

@aghuddleston
aghuddleston / DateFormatBugfix.txt
Created August 8, 2012 19:03
Ext JS 4 Grid Search Plugin originally by Saki and ported by Nathan LeBlanc for Ext JS 4
One bugfix
http://www.sencha.com/forum/showthread.php?23615-Grid-Search-Plugin&p=799141&viewfull=1#post799141
For datecolumns like:
,{
text:'date',
dataIndex:'datecreated',
xtype:'datecolumn',
format:'d.m.Y H:i'
}
@aghuddleston
aghuddleston / LinkButton.css
Created August 6, 2012 18:06
An Ext JS 4.1 link button. It is a button, styled as a link.
button.linkButton {
overflow:visible; /* Shrinkwrap the text in IE7- */
margin:0;
padding:0;
border:0;
color: #2B547D;
background:transparent;
font:inherit !important; /* Inherit font settings (doesn’t work in IE7-) */
line-height:normal; /* Override line-height to avoid spacing issues */
text-decoration:underline; /* Make it look linky */
@aghuddleston
aghuddleston / csv_for_excel.rb
Last active August 10, 2022 19:19
Write a CSV file using Ruby 2.2.2 which can open in Excel, properly displaying accents.
require 'csv'
module DownloadService
OPEN_MODE = "w+:UTF-16LE:UTF-8"
BOM = "\xEF\xBB\xBF" #Byte Order Mark
def student_list
File.open("#{file_name}.tsv", OPEN_MODE) do |f|
csv_file = CSV.generate({:col_sep => "\t"}) do |csv|
# header row
@aghuddleston
aghuddleston / ClearButton.css
Last active August 9, 2022 16:45
Ext.ux.form.field.ClearButton - my version
.ext-ux-clearbutton {
width: 12px;
height: 12px;
background-image: url(./images/clear-text-icon.gif);
background-position: 0 0;
background-repeat: no-repeat;
-moz-user-focus: ignore; /* https://developer.mozilla.org/en/CSS/-moz-user-focus */
cursor: pointer;
position: absolute;
overflow: hidden; /* IE 6 :-( */

Strings

String.prototype.*

None of the string methods modify this – they always return fresh strings.

  • charAt(pos: number): string ES1

    Returns the character at index pos, as a string (JavaScript does not have a datatype for characters). str[i] is equivalent to str.charAt(i) and more concise (caveat: may not work on old engines).

@aghuddleston
aghuddleston / .bashrc
Last active April 4, 2017 17:36 — forked from jusopi/check.sh
Set node version per project using .nvmrc file
cd() {
builtin cd "$1"
if [ -f ".nvmrc" ]; then
nvm use
fi
}
@aghuddleston
aghuddleston / docker-terminal.sh
Created August 18, 2016 13:52 — forked from okunishinishi/docker-terminal.sh
Start docker and change terminal theme on osx.
#!/bin/bash
#
# Start Docker terminal and set theme.
#
TERMINAL_APP="Terminal"
TERMINAL_THEME="Novel"
# Set Terminal theme
osascript -e "
@aghuddleston
aghuddleston / angularjs-addproperty-template.html
Last active August 14, 2016 23:12
AngularJS 1.3 Sample Directives, Filters and Miscellaneous
<!-- Bootstrap 3 -->
<div>
<div class="modal fade" my-modal id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" ng-click="vm.cancel()"><span aria-hidden="true">&times;</span><span
class="sr-only">Close</span></button>
<h4 class="modal-title" id="myModalLabel">Add New Property</h4>
@aghuddleston
aghuddleston / angularjs-addproperty-template.html
Created August 11, 2016 14:55
AngularJS 1.3 Sample Directives, Filters and Miscellaneous
<!-- Bootstrap 3 -->
<div>
<div class="modal fade" my-modal id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" ng-click="vm.cancel()"><span aria-hidden="true">&times;</span><span
class="sr-only">Close</span></button>
<h4 class="modal-title" id="myModalLabel">Add New Property</h4>
@aghuddleston
aghuddleston / AddIndividualCmd.rb
Created July 29, 2016 20:25
"Command" class to create a simple chain of Sidekiq workers and an example worker implementation.
require 'json'
class AddIndividiualCmd
attr_reader :roster_id, :current_step
STEPS = %w(
PhoneInsertWorker
RosterLinkToSchoolWorker
RosterLinkToSchoolAddressWorker