Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View tstachl's full-sized avatar

Thomas Stachl tstachl

  • Pilina
  • Remote
View GitHub Profile
@tstachl
tstachl / mootools.cloneEventsDeep.js
Created October 7, 2010 02:09
Teach mootools to clone events of children too.
Native.implement([Element, Window, Document], {
cloneEventsDeep: function(from, type){
if (this.getChildren().length > 0) {
this.getChildren().each(function(item, index) {
item.cloneEventsDeep(from.getChildren()[index], type);
});
this.cloneEvents(from, type);
} else {
this.cloneEvents(from, type);
}
@tstachl
tstachl / mootools.isNumeric.js
Created October 7, 2010 06:30
Mootools extension, check string is numeric.
String.implement({
isNumeric: function() {
var r = true;
this.split('').each(function(i) {
if ('0123456789.,'.indexOf(i) == -1) {
r = false;
}
});
return r;
}
@tstachl
tstachl / Imap.php
Created November 9, 2010 17:21
Zend_Auth_Adapter to authenticate via IMAP
<?php
/**
* Stachl
*
* LICENSE
*
* This source file is subject to the CC-GNU GPL license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://creativecommons.org/licenses/GPL/2.0/
@tstachl
tstachl / Config.php
Created November 9, 2010 17:24
Zend_Controller_Action_Helper to allow direct access to xml and ini configs saved in APPLICATION_PATH /configs
<?php
/**
* Stachl
*
* LICENSE
*
* This source file is subject to the CC-GNU GPL license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://creativecommons.org/licenses/GPL/2.0/
@tstachl
tstachl / Ping.php
Created November 9, 2010 17:26
Stachl_Ping is a class to ping hosts and get min, avg, max and standard deviation of rountrips
<?php
/**
* Stachl
*
* LICENSE
*
* This source file is subject to the CC-GNU GPL license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://creativecommons.org/licenses/GPL/2.0/
@tstachl
tstachl / replace.py
Created March 12, 2011 01:29
Search and replace a string in a file as a python one-liner
"""
Search and replace a string in a file as a python one-liner
@author Thomas Stachl
@created Mar 12, 2011
@license Attribution 3.0 Unported (CC BY 3.0)
This work is licensed under the Creative Commons Attribution 3.0
Unported License. To view a copy of this license, visit
http://creativecommons.org/licenses/by/3.0/ or send a letter to
@tstachl
tstachl / InheritConfigParser.py
Created March 28, 2011 00:03
A python configparser extension where sections can inherit from previous defined sections.
"""
Stachl
LICENSE
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@tstachl
tstachl / ProxyRb.rb
Created November 19, 2011 01:24
Sinatra Ruby Javascript Ajax Request Proxy
# Copyright (c) 2012, Thomas Stachl <thomas@stachl.me>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
# associated documentation files (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge, publish, distribute,
# sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or
# substantial portions of the Software.
@tstachl
tstachl / gist:2760221
Created May 21, 2012 01:34
Salesforce open Simple Dialog in custom button/link or on a visualforce page
// if you want to use it inside a visualforce page create a function around it
function showFollowUp() {
// if you want to use it in a button make sure you require jQuery
// {!REQUIRESCRIPT("https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js")} // UNCOMMENT IF IN A BUTTON
// get the dialog with your dialog name
var d = sfdcPage.dialogs['MyCoolDialog'], close;
if (!d) {
// if the dialog doesn't exist create one
d = sfdcPage.dialogs['MyCoolDialog'] = new SimpleDialog('MyCoolDialog', false);
// set general information on your dialog and finally run the create function
@tstachl
tstachl / gist:2888905
Created June 7, 2012 13:54
Desk.com Salesforce integration. This snippet shows you how to create a autocomplete field on the contacts template containing all your contacts of your Salesforce organization.
<div class="agent_customer_gravatar">
<span class="a-user-icon">
{{thumb}} {{social_profile}}
</span>
</div>
<div class="agent_customer_section short" >
{{first_name}}
</div>