Skip to content

Instantly share code, notes, and snippets.

View jbubriski's full-sized avatar

John Bubriski jbubriski

View GitHub Profile
@hallettj
hallettj / global-variables-are-bad.js
Created February 14, 2009 21:15
How and why to avoid global variables in JavaScript
// It is important to declare your variables.
(function() {
var foo = 'Hello, world!';
print(foo); //=> Hello, world!
})();
// Because if you don't, the become global variables.
(function() {
anonymous
anonymous / About.cshtml
Created November 10, 2011 14:27
Example of a base view for razor with RouteInfo property
@{
ViewBag.Title = "About Us";
}
<h2>About</h2>
<p>
Hi @RouteInfo.name(), welcome to the @RouteInfo.action() action, which is located in the @RouteInfo.controller() controller
</p>
@topas
topas / gist:1919858
Created February 26, 2012 23:48
ASP.NET MVC Html.LabelFor helper with html attributes
using System;
using System.Linq;
using System.Linq.Expressions;
using System.Web.Mvc;
using System.Web.Routing;
public static class LabelExtensions
{
public static MvcHtmlString LabelFor<TModel, TValue>(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression, object htmlAttributes)
{
@motowilliams
motowilliams / gist:3784042
Created September 25, 2012 19:51
motowilliams opml for Google Listen
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>"Listen Subscriptions" subscriptions via MotoWilliams in Google Reader</title>
</head>
<body>
<outline title="Listen Subscriptions" text="Listen Subscriptions">
<outline text="(406)Sta-rtup" title="(406)Sta-rtup"
type="rss" xmlUrl="http://406startup.com/feed/" htmlUrl="http://406startup.com"/>
@phoboslab
phoboslab / menus.js
Created November 11, 2012 22:13
Z-Type Menu
ig.module(
'game.menus'
)
.requires(
'impact.font'
)
.defines(function(){
MenuItem = ig.Class.extend({
getText: function(){ return 'none' },
@jakeonrails
jakeonrails / Ruby Notepad Bookmarklet
Created January 29, 2013 18:08
This bookmarklet gives you a code editor in your browser with a single click.
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
@ryansobol
ryansobol / gist:5252653
Last active November 22, 2023 11:53
15 Questions to Ask During a Ruby Interview

Originally published in June 2008

When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.

To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.

What to expect

Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.

anonymous
anonymous / gist:5556157
Created May 10, 2013 17:56
var setCookieHeader = response.Headers["SET-COOKIE"];
var sltCookie = setCookieHeader.Substring(0, setCookieHeader.IndexOf(';'));
if (sltCookie.StartsWith("slt"))
{
Cookies.Add(new Cookie("slt", sltCookie.Substring(4), "/", "www.litefighter.com"));
}
@developerdizzle
developerdizzle / ajax-loading.js
Last active December 18, 2015 10:19
jQuery/UpdatePanel busy/loading cursor
// html.ajax-loading { cursor: wait; }
define(['jquery'], function ($) {
$(function () {
var $html = $('html');
var $document = $(document);
var cssClass = 'ajax-loading';
var requests = 0;
function setBusy() {
@remy
remy / batcharge.py
Last active March 6, 2024 00:57
My zsh set up as of July 25, 2013
#!/usr/bin/env python
# saved to ~/bin/batcharge.py and from
# http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/#my-right-prompt-battery-capacity
#!/usr/bin/env python
# coding=UTF-8
import math, subprocess
p = subprocess.Popen(["ioreg", "-rc", "AppleSmartBattery"], stdout=subprocess.PIPE)
output = p.communicate()[0]