Skip to content

Instantly share code, notes, and snippets.

View bkono's full-sized avatar

Bryan Konowitz bkono

View GitHub Profile
@bkono
bkono / 1.js
Created June 19, 2012 05:54 — forked from mxriverlynn/1.js
ajax command wrapper
var signForm = $.ajax({
type: "POST",
url: "/some/form",
dataType: "JSON",
data: myData
});
signForm.done(function(response){
// handle success here
});
@bkono
bkono / ubuntu_redis_install.sh
Created May 7, 2012 05:54
Ubuntu Redis Install
#!/bin/bash
mkdir /opt/redis
#RedisVersion=2.2.14
RedisVersion=2.4.8
wget http://redis.googlecode.com/files/redis-$RedisVersion.tar.gz
tar -zxvf redis-$RedisVersion.tar.gz
cd redis-$RedisVersion
@bkono
bkono / gist:1232401
Created September 21, 2011 15:36
Eager js validation with asp.net mvc 3
<script type="text/javascript">
$(document).ready(function () {
var settngs = $.data($('form')[0], 'validator').settings;
settngs.onfocusout = function (element) { $(element).valid(); };
});
</script>
options: { // options structure passed to jQuery Validate's validate() method
errorClass: "input-validation-error",
errorElement: "span",
@bkono
bkono / spin-js-example.html
Created August 21, 2011 19:27
spin.js example
<!doctype html>
<head>
<title>Hi</title>
<style>
#spin {
background: #333;
color: white;
float: left;
width: 200px;
height: 200px;
@bkono
bkono / callrestservice.cs
Created August 13, 2011 06:07
Call a JSON Rest Service from c# with Newtonsoft.Json
private dynamic CallRestService(string uri, string method, dynamic parms) {
dynamic result;
var req = HttpWebRequest.Create(uri);
req.Method = method;
req.ContentType = "application/json";
byte[] bytes = UTF8Encoding.UTF8.GetBytes(parms.ToString());
req.ContentLength = bytes.Length;
using (var stream = req.GetRequestStream()) {
@bkono
bkono / mash.chirp.config
Created August 9, 2011 04:43
mash.chirp.config -- Default Application and Vendor files
<?xml version="1.0"?>
<root
xmlns="urn:ChirpyConfig"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:ChirpyConfig chirp.xsd">
<FileGroup Name="public/css/application.css" Minify="false">
<Folder Pattern="assets/css/*.min.css" />
</FileGroup>
--'First Day of Last Month, and Last Day of Last Month'
declare @MyDate smalldatetime
set @MyDate = DATEADD(Month, -1, GETDATE())
SELECT CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(@mydate)-1),@mydate),101)
set @MyDate = GETDATE()
SELECT CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(@mydate)),@mydate),101)
server {
listen 80;
server_name www.mysite.com mysite.com;
rewrite ^/(.*) http://iwalkthevine.com permanent;
}
static void Main(string[] args)
{
for (int i = 0; i < 10; i++)
{
var token =
BitConverter.ToString(SHA1.Create().ComputeHash(Encoding.ASCII.GetBytes(Guid.NewGuid().ToString())))
.Replace("-", "").Substring(8, 12).ToLower();
# mongo_template.rb
# remove unneeded defaults
run "rm public/index.html"
run "rm public/images/rails.png"
run "rm public/javascripts/controls.js"
run "rm public/javascripts/dragdrop.js"
run "rm public/javascripts/effects.js"
run "rm public/javascripts/prototype.js"