Skip to content

Instantly share code, notes, and snippets.

View blatyo's full-sized avatar
🎯
Planning

Allen Madsen blatyo

🎯
Planning
View GitHub Profile
login: &login
adapter: mysql
encoding: utf8
reconnect: false
pool: 5
username: ritter2
password: ritter2
socket: /var/run/mysqld/mysqld.sock
development:
var Hotkey = (function(){
var modifiers = ['ctrl', 'shift', 'alt'];
var hotkeys = $H();
return {
add: function(keyCombination, behavior, options){
var keys = keyCombination.split('+');
var mods = keys.union(modifiers);
var key = keys.without.apply(keys, modifiers).reduce();
if(Object.isArray(key)) throw "Error: Hotkey can only contain one key that is not a modifier";
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- omit xml declaration -->
<xsl:output method="xml" omit-xml-declaration="yes" />
<!-- grab tags -->
<xsl:template match="*">
<xsl:text>{</xsl:text>
Object.extend(Array.prototype, {
union: function(otherArray){
if(!Object.isArray(otherArray)) return this;
return this.without.apply(this, this.without.apply(this, otherArray));
}
}
//Put on a text area in java
String action = "'return Event.noBubble( event, RSACommon.limitLength( this, " + maxLength + " ) )'";
javascript = " onkeypress=" + action +
" onkeyup=" + action +
" onkeydown=" + action +
//RSACommon
limitLength: function( elem, maxLength ) {
if( elem.value.length > maxLength ) {
elem.value = elem.value.substring( 0, maxLength );
var remove = true;
$('time').options.each(function(element){
if(remove) element.remove();
remove = !remove;
});
document.observe('a:a', alert); // will call alert(event)
document.fire('a:a');
class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
t.string :username, :null => false # optional, you can use email instead, or both
t.string :email, :null => false # optional, you can use login instead, or both
t.string :crypted_password, :null => false # optional, see below
t.string :password_salt, :null => false # optional, but highly recommended
t.string :persistence_token, :null => false # required
t.string :single_access_token, :null => false # optional, see Authlogic::Session::Params
t.string :perishable_token, :null => false # optional, see Authlogic::Session::Perishability
//Called on dom:ready
buttonDiv.observe('click', instantEstimate.submitOrder.bindAsEventListener(instantEstimate));
//instance method on instantEstimate
submitOrder: function(event){
event.stop();
if(this.isSubmitting){
return;
}
if(this.pendingSave || this.request){
<html>
<head>
<title></title>
<script type="text/javascript" language="javascript" charset="utf-8">
function test(){
var div = document.getElementById('div');
div.style.visibility = 'hidden';
alert(div.style.visibility);
}
</script>