Skip to content

Instantly share code, notes, and snippets.

View sgharms's full-sized avatar

Steven G. Harms sgharms

View GitHub Profile
# Mocking a class method
product = Product.new
Product.expects(:find).with(1).returns(product)
assert_equal product, Product.find(1)
# Mocking an instance method on a real object
product = Product.new
product.expects(:save).returns(true)
assert product.save
@sgharms
sgharms / gist:5778875
Created June 14, 2013 01:50
Comparing to: http://localhost:4567/guides/getting-started/toggle-todo-editing-state I'm doing this on rails with the asset pipeline in an effort to play with Ember 1 some more before we do our upgrade at the end of the quarter. I was following along fine until I hit this one. I don't understand the magic of itemController enough but...it seems …
1 {{#each controller itemController="todo"}}
2 <li {{bindAttr class="isCompleted:completed isEditing:editing"}}>
3 {{#if isEditing}}
4 <input class="edit">
5 {{else}}
6 {{view Ember.Checkbox checkedBinding="isCompleted" class="toggle"}}
7 {{log this.constructor}}
8 {{log this.content.title}}
9 <!-- DOES NOT WORK
10 <label {{action "editTodo" on="doubleClick"}}>{{title}}</label><button class="destroy">>
@sgharms
sgharms / gist:5758773
Created June 11, 2013 17:15
Recruiting, you're doing it wrong:
INMAIL: YOU HAVE A NEW MESSAGE
From: Nick C*
Date: 6/11/2013
Subject: Hiring Mid to Sr. RoR Engineers - Rapidly Growing San Mateo SaaS Startup
Hi Steven,
App.ZazzumIndexRoute = Ember.Route.extend({
model: function() {
return App.Zazzum.find();
}
});
<script type="text/javascript">
/ <![CDATA[ /
var google_conversion_id = ....;
/ ]]> /
</script>
<script type="text/javascript" src="//some/script.js">
</script>
<noscript>
<div style="display:inline;">
diff --git a/public/javascripts/custom/application.js b/public/javascripts/custom/application.js
index 6d55e23..51fd890 100644
--- a/public/javascripts/custom/application.js
+++ b/public/javascripts/custom/application.js
@@ -4,3 +4,8 @@ window.App = Ember.Application.create({
}
});
+App.FunView = Ember.View.extend({
+ templateName: 'fun',
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.stevengharms.algoclass</groupId>
<artifactId>assn1</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>assn1</name>
@sgharms
sgharms / Using printerX function
Created January 10, 2013 20:10
Demonstrating some of the interesting challenges in C programming. To clarify these concepts I referred to: http://www.geeksforgeeks.org/memory-layout-of-c-program/.
saw a length of 12 for clone 'Hello, World'
saw a length of 12 for clone 'HeXYo, World'
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font:inherit;font-size:100%;vertical-align:baseline}html{line-height:1}ol,ul{list-style:none}table{border-collapse:collapse;border-spacing:0}caption,th,td{text-align:left;font-weight:normal;vertical-align:middle}q,blockquote{quotes:none}q:before,q:after,blockquote:before,blockquote:after{content:"";content:none}a img{border:none}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section,summary{display:block}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section,summary{display:block}a{color:#1863a1}a:visited{color:#751590}a:focus{color:
_move: function( direction, filter, event ) {
var next, wrapItem;
var activeSubmenu = this.active;
var activeSubmenusParentMenubarItem = activeSubmenu.closest( ".ui-menubar-item" );
//var nextSelection
debugger;
if ( this.open ) {
next = [ direction + "All" ]( this.options.items ).first().children( ".ui-menu" ).eq( 0 );