Skip to content

Instantly share code, notes, and snippets.

View jasperkennis's full-sized avatar
💨
CODING

Jasper Kennis jasperkennis

💨
CODING
View GitHub Profile
@endel
endel / number-pad-zero.js
Last active August 1, 2023 11:54
Simplest way for leading zero padding in JavaScript
Number.prototype.pad = function(size) {
var s = String(this);
while (s.length < (size || 2)) {s = "0" + s;}
return s;
}
(1).pad(3) // => "001"
(10).pad(3) // => "010"
(100).pad(3) // => "100"
module StrongAdmin
extend ActiveSupport::Concern
def initialize
@instance_name = active_admin_config.resource_name.downcase
@klass = active_admin_config.resource_name.constantize
@column_names = @klass.columns.map do |column|
unless [:id, :created_at, :updated_at].include?(column.name.to_sym)
@jpurcell
jpurcell / pull-to-refresh(android).js
Created April 5, 2011 15:58
Tweetie-like pull to refresh and pull to load more. Note that it requries set heights for everything.
// This is the Android version of the Tweetie-like pull to refresh table:
// http://developer.appcelerator.com/blog/2010/05/how-to-create-a-tweetie-like-pull-to-refresh-table.html
var win = Ti.UI.currentWindow;
var alertDialog = Titanium.UI.createAlertDialog({
title: 'System Message',
buttonNames: ['OK']
});
var scrollView = Ti.UI.createScrollView({