Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am samknight on github.
  • I am samknight (https://keybase.io/samknight) on keybase.
  • I have a public key ASAGmkxSo-7WQN80Uf74QWSguQXlClcD2Of6Y3lXqEOmNwo

To claim this, I am signing this object:

@samknight
samknight / fuzzyregex.js
Created February 7, 2014 14:39
Fuzzy Regex match
// This will allow unordered search terms to match relevant string
// e.g. Really Long String will be matched by
// - long string
// - long really
// - all ring
// ..etc
// I have used this anonymous function to override the matcher function in select2
function(term, text) {
@samknight
samknight / integer_string
Created August 10, 2012 09:38
Test a string is a valid number
# I couldn't find a nice way of working out whether a string is an integer other than using regex
# So here is another way of checking
number_string.to_i.to_s == number_string ? # integer : # not an integer