Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Collections;
using System.Text.RegularExpressions;
namespace website.lib
{
public enum BadwordSensitivity
{
low = 1, medium = 2, high = 3
@sipple
sipple / github_api.rb
Created March 1, 2010 20:49
Beginnings of a Github API class.
class GithubAPI
require 'net/http'
require 'net/https'
require 'uri'
require 'open-uri'
# Get the configuration values from APP_CONFIG
Token = APP_CONFIG['github_api_token']
Base_Url = APP_CONFIG['github_api_url']
User = APP_CONFIG['github_api_user']
#Set Primary address a.k.a Billing Address [ugh]
class BillingInformationController < ApplicationController
no_login_required
before_filter :must_be_at_least_an_authenticated_user
before_filter :cart_should_not_be_empty
radiant_layout 'normal'
helper :users, :orders
for (int i = 0; i < dummyPkgs.Count; i++)
{
DataRow rslt_row = rslt.NewRow();
rslt_row[col_pkg_no] = dummyPkgs[i].Row["package_no"];
rslt_row[col_pkg_desc] = dummyPkgs[i].Row["description"];
decimal[] zone_prices = new decimal[ZONE_COUNT];
for (int j = 0; j < ZONE_COUNT; j++)
{
zone_prices[j] = 0M;
}
module Webservices
module Responses
module GetOrder
class GetOrderResponse
include Webservices::Responses::ResponseErrorHandler, CulturaldistrictApp::OrderDetails
attr_reader :order, :line_items, :shipping_address, :contributions, :gift_cards,
:redeemed_gift_cards, :gift_card_fees, :parking_line_items, :restaurant_line_items, :package_line_items,
:flex_package_line_items, :package_parking_line_items, :package_restaurant_line_items, :fee_line_items,
:super_package_line_items
$(document).ready(function() {
$('td.notes_container input[type="button"]').each(function(index) {
$(this).click(function(event) {
var container = $(this).parent();
ajaxPostNotes(container);
});
});
});
@sipple
sipple / googlecrap.rb
Created June 21, 2011 18:31
Google Crap
module GoogleCustomSearch
class SearchResultItem
attr_reader :title, :content
def initialize(hash = {})
@errors = []
hash.each do |key, value|
self.instance_variable_set("@#{key}", value)
@sipple
sipple / hashthis.js
Created July 11, 2011 15:47
Hash This
function checkCredentials() {
// Set user action to Authenticate
document.UserForm.useraction.value = 'login';
if (document.UserForm.url.value == '') {
alert('Please enter the authenticatin url');
return false;
}
if (document.UserForm.username.value == '' || document.UserForm.password.value == '') {
@sipple
sipple / about.md
Created August 9, 2011 16:56 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@sipple
sipple / gist:3939944
Created October 23, 2012 16:35
Time validation
<script type="text/javascript">
jQuery(document).ready(function($){
$('.datepicker').datepicker({ changeMonth: true, changeYear: true, minDate: '-1y', maxDate: '+3y'});
$.validator.addMethod("time", function(value, element) {
return this.optional(element) || /^(([0-1]?[0-9])|([2][0-3])):([0-5]?[0-9])(:([0-5]?[0-9]))?$/i.test(value);
}, "Please enter a valid time.");
$("#post").validate({
rules: {
time: "required time"