Skip to content

Instantly share code, notes, and snippets.

View greggnakamura's full-sized avatar

Gregg Nakamura greggnakamura

View GitHub Profile
@greggnakamura
greggnakamura / gist:3779783
Created September 25, 2012 03:15 — forked from padolsey/gist:527683
Javascript: Detect IE
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@greggnakamura
greggnakamura / Fetch.sublime-settings
Created September 25, 2012 03:18 — forked from t8g/Fetch.sublime-settings
SublimeText2: Nettuts Fetch
{
"files":
{
"cycle": "http://malsup.github.com/jquery.cycle.all.js",
"infinite_scroll": "https://github.com/paulirish/infinite-scroll/blob/master/jquery.infinitescroll.min.js",
"jquery": "http://code.jquery.com/jquery.min.js",
"localscroll": "http://flesler-plugins.googlecode.com/files/jquery.localscroll-1.2.7-min.js",
"raphael": "http://github.com/DmitryBaranovskiy/raphael/raw/master/raphael-min.js",
"reset": "http://meyerweb.com/eric/tools/css/reset/reset.css",
"scrollorama": "https://github.com/johnpolacek/scrollorama/blob/master/js/jquery.scrollorama.js",
@greggnakamura
greggnakamura / Github OAuth ASP.Net MVC
Created September 25, 2012 18:12 — forked from codeimpossible/Github OAuth ASP.Net MVC
MVC: Github OAuth callback for ASP.Net MVC. Set yourapp.com/github/callback as the OAuth callback URL when you setup your application. If the users chooses to grant you permission, this controller/action get called to complete the transaction. See http://
public class GithubController : Controller
{
/// <summary>
/// Github OAuth Callback
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
public JsonResult callback(string code)
{
var clientId = "[insert yours]";
@greggnakamura
greggnakamura / JobsController.cs
Created October 9, 2012 00:51 — forked from codeimpossible/JobsController.cs
MVC: JobsController from Proggr; Implicitly cast to POCOs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Proggr.Controllers.Filters;
using Proggr.Controllers.Responses;
namespace Proggr.Controllers
{
@greggnakamura
greggnakamura / peta_poco.cs
Created October 17, 2012 01:10 — forked from codeimpossible/peta_poco.cs
MVC: PetaPoco Example
[PetaPoco.TableName("People")]
[PetaPoco.PrimaryKey("Id")]
public class Person
{
public int Id { get; set; }
// .. some other fields
}
public ActionResult Create( Person person )
{
@greggnakamura
greggnakamura / index.html
Created December 21, 2012 15:30 — forked from anonymous/index.html
Countdown Clock
<div class="container">
<ul class="flip minutePlay">
<li>
<a href="#">
<div class="up">
<div class="shadow"></div>
<div class="inn">0</div>
</div>
<div class="down">
<div class="shadow"></div>
sub, sup {
/* Specified in % so that the sup/sup is the
right size relative to the surrounding text */
font-size: 75%;
/* Zero out the line-height so that it doesn't
interfere with the positioning that follows */
line-height: 0;
/* Where the magic happens: makes all browsers position
public void NonQuery()
{
var connectionString = ConfigurationManager.ConnectionStrings["Default"].ConnectionString;
var sqlCommandText = "UPDATE People SET Name = 'John'";
using (var sqlConnection = new SqlConnection(connectionString))
using (var sqlCommand = new SqlCommand(sqlCommandText, sqlConnection))
{
sqlCommand.Connection.Open();
(function ($) {
$(function () {
var $html = $('html');
var requests = 0;
function setBusy() {
if (++requests == 1) {
$html.addClass('busy-cursor');
}
}
@greggnakamura
greggnakamura / README.md
Last active November 14, 2015 00:27 — forked from hofmannsven/README.md
Git: Using Git