Skip to content

Instantly share code, notes, and snippets.

@dmonopoly
dmonopoly / ssh key problem
Created June 21, 2011 20:45
after transferring my public and private key to a new machine, permissions on the private key changed, leading to this error.
$ ssh git@github.com -v
OpenSSH_5.2p1, OpenSSL 0.9.8l 5 Nov 2009
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to github.com [207.97.227.239] port 22.
debug1: Connection established.
debug1: identity file /Users/daze/.ssh/identity type -1
debug1: identity file /Users/daze/.ssh/id_rsa type 1
debug1: identity file /Users/daze/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debian-5github2
debug1: match: OpenSSH_5.1p1 Debian-5github2 pat OpenSSH*
@dmonopoly
dmonopoly / help with show.js.coffee
Created July 22, 2011 22:38
Coffeebeans; trying to get app/views/restaurants/show.js.coffee to work; the alert doesn't appear
# Controller
class RestaurantsController < ApplicationController
def show
@restaurant = Restaurant.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.js # show.js.coffee
end
end
end
@dmonopoly
dmonopoly / gist:1164395
Created August 23, 2011 05:16
nil and false notion...
def mealtimes(meal)
arr = [meal.breakfast, meal.lunch, meal.dinner]
if arr == [true, true, true]
"breakfast, lunch, and dinner"
elsif arr == [false, false, false]
""
elsif arr == [true, true, false]
"breakfast and lunch"
elsif arr == [true, false, true]
"breakfast and dinner"
$(".memory").hover ->
memory = $(this).attr('id')
id = memory.split('_')[1] # get id of e.g. memory_4
#find memory
time_frames = <% Memory.find(id).time_frames %>
for time_frame in time_frames
tf_id = time_frame.id
$("#"+tf_id).toggle()
@dmonopoly
dmonopoly / gist:1500327
Created December 20, 2011 04:59
Coffeescript - methods using methods?
# Implementation of Application.Memory.Index class
jQuery ->
@module "Application.Memory", ->
class @Index
# Needed because the height depends on window size
setHeightOfLifeTimeFrame: ->
height = `$(document).height()`
$('#life_time_frame').css('height', height-50 + 'px');
@dmonopoly
dmonopoly / gist:1513155
Created December 23, 2011 04:35
How do you convert this animate method of jQuery to CoffeeScript?
$('#book').animate({
opacity: 0.25,
left: '+=50',
height: 'toggle'
}, 5000, function() {
// Animation complete.
});
//////////////////////////////////////////////////////////////////////////////////
// Author: Brandon Franzke
// Create Date: 2013-02-04
// Modified:
// File Name: ee201_clk_60Hz.v
// Description:
//
//
// Revision: 1.1
// Additional Comments:
@dmonopoly
dmonopoly / gist:4752920
Last active December 12, 2015 09:39
ee201_roller.v
`timescale 1ns / 1ps
module ee201_roller(Clk, Reset, NewX, X);
/* INPUTS */
// Clock & Reset
input Clk, Reset;
input NewX;
/**
@dmonopoly
dmonopoly / gist:4753033
Created February 11, 2013 06:52
ff_reset_verilog.v
//----------------------------------------------------------------------------
// A verilog module for a ff_reset (based on my vhdl module ff_reset.vhd)
// Written by Gandhi Puvvada Date: 2/15/2008
// File name: ff_reset.v
// Analyze and simulate for 550ns in modelsim.
// Answer all questions posted below.
//----------------------------------------------------------------------------
// When you compile this design in synopsys, use the following command so that,
// the mapped design can NOT use complex cells with builtin muxes.
// set_dont_use lcb500kv/FDS*
@dmonopoly
dmonopoly / gist:4951167
Created February 14, 2013 07:33
divider_combined_cu_dpu.v
// ----------------------------------------------------------------------
// A Verilog module for a simple divider
// Written by Gandhi Puvvada Date: 7/17/98, 2/15/2008, 10/13/08, 2/21/2010
// File name: divider_combined_cu_dpu.v
// ------------------------------------------------------------------------
// This is an improvement over divider.v
// We combined the two separate case statements in the divider.v
// into one single case statement.
// Notice the following lines added because of this combining
// X <= 4'bXXXX; // to avoid recirculating mux controlled by Reset