Skip to content

Instantly share code, notes, and snippets.

https://www.tripadvisor.com/Attractions-g29220-Activities-Maui_Hawaii.html
Haleakala Crater
Ka'anapali Beach
Road to Hana
Snorkeling Tours
@polycarpou
polycarpou / tearable_cloth.md
Created May 11, 2017 16:13
Explanation of how the tearable cloth is built

One of the things that I have been very interested in but never got around to learning has been animations. I find them fascinating, I think every person who grew up playing games does, and I have been eager to find the best entry point into that world. Then I saw @suffick's tearable cloth. After playing around with it for a crazy amount of time, I started checking out the code. 300 lines of well written javascript and no external libraries. A basic physics engine that simulates a cloth. I will now explain in detail how it all works. The Tearable Cloth

So it all starts with the <canvas id=“c”></canvas> element in the html. Thats the only html you need and then you can let the javascript do the work. Oh and you dont need any CSS either; dont you love it when things are simple? The <canvas> tag is used to draw graphics in the browser with javascript. When the program loads we need to do some simple configurations to the canvas el

@polycarpou
polycarpou / cloth.html
Created May 11, 2017 16:05
Tearable Cloth
<!DOCTYPE html>
<html>
<head>
<title>Tearable Cloth</title>
</head>
<body>
@polycarpou
polycarpou / serialize.rb
Created October 15, 2013 13:32
day 16 todo, serialize method
RSpec.configure do |config|
# Use color in STDOUT
config.color_enabled = true
# Use color not only in STDOUT but also in pagers and files
config.tty = true
# Use the specified formatter
config.formatter = :progress # :progress, :html, :textmate
end
@polycarpou
polycarpou / ruby.vowels.rb
Created October 11, 2013 15:44
ruby vowels day 4 morning todo
# Download this file:
# https://gist.github.com/aviflombaum/28534c5d69edd2439a7d/download
# Run it from your terminal with:
# ruby ruby.basics.rb
# (Just make sure you are in the right directory)
# ======================================
# Ignore All This Code
# ======================================
@polycarpou
polycarpou / ruby.basics.rb
Created October 11, 2013 15:28
Day 3 morning todo. Ruby basics
# Download this file:
# https://gist.github.com/aviflombaum/28534c5d69edd2439a7d/download
# Run it from your terminal with:
# ruby ruby.basics.rb
# (Just make sure you are in the right directory)
# ======================================
# Ignore All This Code
# ======================================
@polycarpou
polycarpou / roman_numerals
Last active December 25, 2015 06:49
Roman Numerals conversion - day 15 morning todo.
class Fixnum
def set_digits
number_array = self.to_s.chars
#result = ""
digit = []
4.times do |i|
digit[i+1] = number_array.pop.to_i
end
digit
end
@polycarpou
polycarpou / person.rb
Created October 10, 2013 14:45
Day 14: TODO: Mass-assignment of properties at initialization
class Person
def initialize(attributes)
attributes.each do |key,value|
Person.send(:define_method, key){value}
end
end
end
@polycarpou
polycarpou / triangle.rb
Created October 9, 2013 13:39
triangle todo day 13
class Triangle
attr_accessor :a, :b, :c
def initialize(a,b,c)
@a = a
@b = b
@c = c
end
def kind
if [self.a, self.b, self.c].any?{|x| x <= 0}
@polycarpou
polycarpou / school.rb
Created October 9, 2013 00:28
Domain Model for a School day - 12 homework
class School
attr_accessor :roster
def initialize(school_name)
@roster = {}
end
def add_student(student_name, grade)
self.roster[grade] ||= []
self.roster[grade] << student_name
end