Skip to content

Instantly share code, notes, and snippets.

View jgable's full-sized avatar

Jacob Gable jgable

  • Making Other People Money
  • Redwood City, CA
  • X @jacob4u2
View GitHub Profile
@jgable
jgable / ChatView.cshtml
Created April 12, 2011 22:14
ChatView.cshtml - A Razor View file for our Chat Server Example
@model MotherEffinChatSite.Models.HomeVM
@{
Page.Title = "MVC Chat Example";
}
@section ScriptSection {
<!-- The new message template... TODO: make it sexy -->
<script id="msgTmpl" type="text/x-jquery-tmpl">
<li><p style="margin-bottom:-2px; color: black;"><strong>${user.name}</strong></p><p>${message}</p></li>
@jgable
jgable / Enum_RadioButtonList.cshtml
Created May 15, 2011 20:02
A helper for showing a RadioButton List in .Net MVC 3
@model Enum
@{
// Looks for a [Display(Name="Some Name")] Attribute on your enum
Func<Enum, string> getDescription = en =>
{
Type type = en.GetType();
System.Reflection.MemberInfo[] memInfo = type.GetMember(en.ToString());
if (memInfo != null && memInfo.Length > 0)
@jgable
jgable / sandbox-mocha.js
Created May 8, 2014 15:29
Sinon Sandbox Example
var sinon = require('sinon'),
Widget = require('../../widget');
describe('My widget', function () {
var sandbox;
beforeEach(function () {
// Create a sandbox for the test
sandbox = sinon.sandbox.create();
});
@jgable
jgable / membershiptables.sql
Created December 23, 2011 02:43
aspnet_regsql membership scripts
/*************************************************************/
/*************************************************************/
/*************************************************************/
-- Create the temporary permission tables and stored procedures
-- TO preserve the permissions of an object.
--
-- We use this method instead of using CREATE (if the object
-- doesn't exist) and ALTER (if the object exists) because the
-- latter one either requires the use of dynamic SQL (which we want to
@jgable
jgable / index.js
Created September 27, 2013 19:52
Ghost Kudos Plugin Example
var fs = require('fs'),
path = require('path'),
_ = require('underscore'),
when = require('when'),
express = require('express'),
GhostPlugin = require('../../../core/server/plugins/GhostPlugin'),
knex = require('../../../core/server/models/base').Knex,
KudosPlugin;
KudosPlugin = function (ghost) {
@jgable
jgable / DontDropDBJustCreateTables.cs
Created March 31, 2011 02:37
DontDropDBJustCreateTables Entity Framework code first helper for AppHarbor by Joachim Lykke Andersen
// Original code by Joachim Lykke Andersen; http://devtalk.dk/2011/02/16/Workaround+EF+Code+First+On+AppHabour.aspx
using System.Data.Entity;
using System.Data.Entity.Database;
using System.Data.Entity.Design;
using System.Data.Entity.Infrastructure;
using System.Data.Metadata.Edm;
using System.Data.Objects;
using System.Globalization;
using System.Linq;
@jgable
jgable / example1.ios.js
Created March 30, 2015 01:13
TouchableHighlight Examples
/**
* Touchable Highlight example (that fires invariant as expected)
*/
'use strict';
var React = require('react-native');
var {
AppRegistry,
StyleSheet,
Text,
@jgable
jgable / requiresToImports.js
Last active June 1, 2017 23:28 — forked from ide/requiresToImports.js
Converts commonJS requires to es6 imports
/**
### Regular component require statement
```
const Token = require('v2/core/components/tokenizer/token');
-> import Token from 'v2/core/components/tokenizer/token';
```
### Destructured require statement
```
@jgable
jgable / arraysEqual.coffee
Created November 15, 2012 16:26
Arrays Equal in CoffeeScript
arraysEqual = (nums1, nums2) ->
# Check the length
return false unless nums1.length == nums2.length
# Sort the arrays
nums1.sort()
nums2.sort()
# A helper for checking indices are same
@jgable
jgable / KeywordGrabber.cs
Created September 15, 2011 17:43
KeywordGrabber
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
// http://bingsharp.codeplex.com/
using Bing;
// http://nuget.org/List/Packages/HtmlAgilityPack
using HtmlAgilityPack;