Skip to content

Instantly share code, notes, and snippets.

View amokan's full-sized avatar

Adam Mokan amokan

  • Grain
  • Chandler, Arizona
  • 09:51 (UTC -07:00)
View GitHub Profile
@amokan
amokan / gist:213063
Created October 19, 2009 03:34 — forked from peterc/gist:40246
# NAME: authinabox
# VERSION: 1.01 (Dec 27, 2008)
# AUTHOR: Peter Cooper [ http://www.rubyinside.com/ github:peterc twitter:peterc ]
# DESCRIPTION: An "all in one" Sinatra library containing a User model and authentication
# system for both session-based logins OR HTTP Basic auth (for APIs, etc).
# This is an "all in one" system so you will probably need to heavily tailor
# it to your own ideas, but it will work "out of the box" as-is.
# COMPATIBILITY: - Tested on 0.3.2 AND the latest rtomayko Hoboken build! (recommended for the latter though)
# - NEEDS DataMapper!
# - Less work needed if you use initializer library -- http://gist.github.com/40238
@amokan
amokan / .gitignore
Created November 13, 2009 15:41
.gitignore file I use for VS2008 C# projects
obj
bin
*.user
*.suo
*.cache
*.scc
*.vssscc
*.vspcc
*.bak
*.log
@amokan
amokan / jQuery_Intellisense
Created November 13, 2009 15:55
notes on setting up intellisense for jQuery in Visual Studio
http://www.learningjquery.com/2009/07/setting-up-visual-studio-intellisense-for-jquery
Download the files and add them to your project.
IntelliSense in external JavaScript files
At the top of the JavaScript file in which you would like to have jQuery IntelliSense enabled, you will need to add a line to reference the documentation file:
/// <reference path="jquery-1.3.2-vsdoc2.js" />IntelliSense inline on your ASPX page
There are a couple of scenarios that may affect if you include a reference to the VSDOC file or not. If in doubt, just add a reference to the documentation file.
@amokan
amokan / rails3_windows_setup
Created August 30, 2010 04:50
my rails3 setup for windows
install ruby 1.9.2-p0 - http://rubyforge.org/frs/download.php/72170/rubyinstaller-1.9.2-p0.exe
install documentation - http://rubyforge.org/frs/download.php/72161/ruby-1.9.2-p0-doc-chm.7z
download and extract devkit to c:\DevKit\ - http://github.com/downloads/oneclick/rubyinstaller/DevKit-4.5.0-20100819-1536-sfx.exe
setup devkit (http://wiki.github.com/oneclick/rubyinstaller/development-kit)
-command line into C:\DevKit and verify rubygems: gem update --system
-init devkit via dk.rb: ruby dk.rb init
-check config.yml file for path: ruby dk.rb review
-install devkit: ruby dk.rb install
(optional) verify install: gem install rdiscount --platform=ruby
:ruby -rubygems -e "require 'rdiscount'; puts RDiscount.new('**Hello RubyInstaller**').to_html"
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl http://npmjs.org/install.sh | sh
@amokan
amokan / RequestTimingFilter.cs
Created July 15, 2011 19:37
example of IResultFilter and IActionFilter
using System.Diagnostics;
using System.Web.Mvc;
namespace YourApp.Web.Infrastructure.Filters
{
/// <summary>
/// Filter to display the execution time of both the action and result
/// </summary>
public class RequestTimingFilter : IActionFilter, IResultFilter
{
@amokan
amokan / DomainAuthorize.cs
Created July 18, 2011 04:35
Example AuthorizeFilter and session model for checking the domain of a request
using System;
using System.Web;
using System.Web.Mvc;
using MvcTest.Models;
namespace MvcTest.Infrastructure.Filters
{
/// <summary>
/// authroize filter for checking the domain.
/// may be a possible solution for handling
@amokan
amokan / nodetest.js
Created July 20, 2011 22:09
simple node sample that i used to test on a Windows Azure Worker Role
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('Sweet! node.js is running on Windows Azure\n');
}).listen(80);
console.log('Server running on port 80');
@amokan
amokan / .gitignore
Created July 28, 2011 03:29
current .gitignore for .NET projects
# Numerous always-ignore extensions
*.diff
*.err
*.orig
*.log
*.rej
*.swo
*.swp
*.vi
*~
@amokan
amokan / gist:1171952
Created August 25, 2011 21:06
mongo db command for dropping a "field"
db.<collection>.update({}, {$unset: {<attrib>:1}},false, true)