Skip to content

Instantly share code, notes, and snippets.

View pdebelak's full-sized avatar
🦄

Peter Debelak pdebelak

🦄
View GitHub Profile
@pdebelak
pdebelak / d3_solar_panel_example.html
Last active August 29, 2015 14:02
Example solar panel drawing in D3
<html>
<head>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
</head>
<body>
<script>
// set the height and width of your objects, if they are always the same. I assume this would be the case for a panel at least. You can always hard code it in the data array.
var house = {width: 24, height: 17.5}
var panel = {width: 2.5, height: 5.5}
// set size of you overall svg field. I arbitrarily chose 800 square.
@pdebelak
pdebelak / find_lefts.js
Last active August 29, 2015 14:02
Way to find all elements on a page with a negative text-indent value for Dan Yoachim
function find_lefts() {
var all = document.getElementsByTagName('*');
var left_elements = [];
for (var i=0;i<all.length;i++) {
ti = window.getComputedStyle(all[i]).getPropertyValue('text-indent');
if (ti.match(/-/)) {
left_elements.push(all[i]);
}
}
return left_elements;
@pdebelak
pdebelak / spec.rb
Last active August 29, 2015 14:01
Rspec test skeleton generator
#!/usr/bin/env ruby
class SpecMaker
def initialize(file_info)
@classes_modules_and_methods = file_info[:classes_modules_and_methods]
@file_name = file_info[:file_name]
end
def write
File.open("#{file_name}_spec.rb", 'w') do |f|
@pdebelak
pdebelak / gc1_user_stories.js
Last active September 6, 2016 18:47
User Stories for DBC Unit 1 Week 2 group project
// As a user, I want to be able to add a list of numbers together to get their sum.
// As a user, I want to be able to find the mean of a list of numbers.
// As a user, I want to be able to find the median of a list of numbers.
/* Reflection: I think this challenge helped show a little bit about how working in a group as a programmer happens. Clearly communication is very important if many different people are working on different aspects of the same program to make sure everyone is on the same page. I'm glad we did this challenge.*/