Skip to content

Instantly share code, notes, and snippets.

Jesal Gadhia jesalg

Block or report user

Report or block jesalg

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am jesalg on github.
  • I am jesalg (https://keybase.io/jesalg) on keybase.
  • I have a public key whose fingerprint is 97B2 A152 B38F 12BF 08A2 6764 8176 2DFB 2471 D7BC

To claim this, I am signing this object:

View gist:4689966
class User extends AppModel {
public function beforeSave($options = array()) {
if (isset($this->data['User']['password'])) {
$this->data['User']['password'] = AuthComponent::password($this->data['User']['password'], $this->data['User']['email']);
}
return true;
}
}
@jesalg
jesalg / filter.js
Created Dec 2, 2011
JavaScript List Filter
View filter.js
// Custom css expression for a case-insensitive contains()
$.expr[':'].Contains = function(a,i,m){
return (a.textContent || a.innerText || "").toUpperCase().indexOf(m[3].toUpperCase())>=0;
};
// Search function for Find Partners
var listFilter = function() {
var input = $("input.filterinput");
var list = $("#list");
@jesalg
jesalg / remove_dups.rb
Last active Aug 29, 2015
Simple function to remove duplicates
View remove_dups.rb
class Array
def remove_dups!
dup_count = Hash.new(0)
self.each do |val|
dup_count[val] += 1
end
dup_count.each do |val, count|
if count > 1
(count-1).times { self.delete_at self.rindex(val) }
You can’t perform that action at this time.