This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class Extensions | |
{ | |
public static bool IsNumeric(this String value) | |
{ | |
return Regex.IsMatch(value, @"^\d+$"); | |
} | |
public static string Numeric(this string value) | |
{ | |
return Regex.Replace(value, "\\D", String.Empty); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.prototype.padLeft = function(length, s) { | |
var pad = []; | |
var padding = length - this.length; | |
if (padding > 0) { | |
for (i = 0; i < padding; i++) pad.push(s); | |
return pad.join('') + this; | |
} | |
return this + ''; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//case-insensitive selector for ASP.Net ID's | |
//usage: $(':aspnetid(id)') | |
jQuery.extend( | |
jQuery.expr[":"], | |
{ | |
aspnetid: function(a, i, m) { | |
return (new RegExp(m[3] + '$', 'i')).test(jQuery(a).attr('id')); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private bool ValidEmailAddress(string emailAddress) | |
{ | |
string qtext = "[^\\x0d\\x22\\x5c\\x80-\\xff]"; // <any CHAR excepting <">, "\" & CR, and including linear-white-space> | |
string dtext = "[^\\x0d\\x5b-\\x5d\\x80-\\xff]"; // <any CHAR excluding "[", "]", "\" & CR, & including linear-white-space> | |
string atom = "[^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+"; // *<any CHAR except specials, SPACE and CTLs> | |
string quoted_pair = "\\x5c[\\x00-\\x7f]"; // "\" CHAR | |
string quoted_string = string.Format("\\x22({0}|{1})*\\x22", qtext, quoted_pair); // <"> *(qtext/quoted-pair) <"> | |
string word = string.Format("({0}|{1})", atom, quoted_string); //atom / quoted-string | |
string domain_literal = string.Format("\\x5b({0}|{1})*\\x5d", dtext, quoted_pair); // "[" *(dtext / quoted-pair) "]" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export: | |
foreach ($n in (1..15)) { cmd.exe /c "mysqldump -u root --password={password here} s88franchise$n > s88franchise$n.sql" } | |
import: | |
foreach ($n in (1..15)) { cmd.exe /c "mysql -u root --password={password here} s88franchise$n < s88franchise$n.sql" } | |
import (bash): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://blog.stevenlevithan.com/archives/faster-trim-javascript | |
function trim12 (str) { | |
var str = str.replace(/^\s\s*/, ''), | |
ws = /\s/, | |
i = str.length; | |
while (ws.test(str.charAt(--i))); | |
return str.slice(0, i + 1); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ Page Language="C#" %> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<script runat="server"> | |
protected void Page_Load(object sender, EventArgs e) | |
{ | |
Response.AddHeader("Refresh", Convert.ToString((Session.Timeout * 60) - 10)); | |
} | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/Users/adam/.rvm/gems/ruby-1.8.7-p299@rails3/gems/activerecord-3.0.3/lib/active_record/connection_adapters/mysql_adapter.rb:22:in `mysql_connection': !!! Missing the mysql2 gem. Add it to your Gemfile: gem 'mysql2' (RuntimeError) | |
from /Users/adam/.rvm/gems/ruby-1.8.7-p299@rails3/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:228:in `send' | |
from /Users/adam/.rvm/gems/ruby-1.8.7-p299@rails3/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:228:in `new_connection' | |
from /Users/adam/.rvm/gems/ruby-1.8.7-p299@rails3/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:236:in `checkout_new_connection' | |
from /Users/adam/.rvm/gems/ruby-1.8.7-p299@rails3/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:190:in `checkout' | |
from /Users/adam/.rvm/gems/ruby-1.8.7-p299@rails3/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# batch-rename files by extension less -> scss | |
for f in *less ; do mv $f `basename $f less`scss; done |
OlderNewer