Skip to content

Instantly share code, notes, and snippets.

View ArtBears's full-sized avatar

Glyne J. Gittens ArtBears

View GitHub Profile
@ArtBears
ArtBears / strip HTML tags
Created March 31, 2016 18:38 — forked from awesome/strip HTML tags
ruby strip HTML tags
# copied from (thanks!): http://codesnippets.joyent.com/posts/show/615
str = <<HTML_TEXT
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<body>
<h1>Application error</h1>
<p>Change this error message for exceptions thrown outside of an action (like
in Dispatcher setups or broken Ruby code) in public/500.html</p>
@ArtBears
ArtBears / frontendDevlopmentBookmarks.md
Last active August 29, 2015 14:26 — forked from dypsilon/frontendDevlopmentBookmarks.md
A badass list of frontend development resources I collected over time.
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
<!-- Respect Rollcall -->
<li><a href="http://www.alistapart.com/articles/">A List Apart &#8212; for website builders</a></li>
<li><a href="http://abstrusegoose.com/">Abstruse Goose &#8212; my favorite comic</a></li>
<li><a href="http://al3x.net/">Alex Payne &#8212; technology rambling</a></li>
<li><a href="http://dashes.com/anil/">Anil Dash &#8212; on culture, apple &amp; design</a></li>
<li><a href="http://weblogs.mozillazine.org/asa/">Asa Dotzler &#8212; on mozilla &amp; software</a></li>
<li><a href="http://www.azarask.in/blog/">Aza Raskin &#8211; on design &amp; firefox</a></li>
<li><a href="http://christophzillgens.com/en/">Christoph Zillgens &#8212; interface design</a></li>
<li><a href="http://cssremix.com/">CSS Remix &#8212; gorgeous designs</a></li>
<li><a href="http://css-tricks.com/">CSS Tricks</a></li>
@ArtBears
ArtBears / FizzBuzz.cpp
Created May 10, 2013 20:02
The c++ version of the FizzBuzz problem.
#include <iostream>
using namespace std;
int main() {
int a(1);
for(int i = 1; i < 101; i++)
{
a = i;
if(a % 3 == 0 && a % 5 == 0)
@ArtBears
ArtBears / Fizzbuzz.rb
Created May 10, 2013 20:00
My Ruby Version of FizzBuzz
#Fizbuzz project
=begin
Write a program that prints out the numbers 1 to 100 (inclusive).
If the number is divisible by 3, print Fizz instead of the number. If
it's divisible by 5, print Buzz. If it's divisible by both 3 and 5,
print FizzBuzz.
=end
def fizzbuzz
(1..100).each do |x|
if x % 3 == 0 && x % 5 == 0
@ArtBears
ArtBears / CardTrick.rb
Created May 10, 2013 07:17
I recreated my other card trick which was in c++ to a ruby application. I'm trying to see if I can simplify the code even more.
=begin
This is a number analogy to a famous card trick.
Ask the user to enter a three-digit number. Think
of the number as ABC (where A, B, C are the three
digits of the number). Now, find the remainders of
the numbers formed by ABC, BCA, and CAB when divided
by 11. We will call these remainders X, Y, Z. Add
them up as X+Y, Y+Z, Z+X. If any of the sums are odd,
increase or decrease it by 11 (whichever operation
results in a positive number less than 20; note if
@ArtBears
ArtBears / movie_ratings.rb
Created May 10, 2013 05:36
Movie ratings practice for codecademy
movies = { Pocahontus: 4,
The_Lion_King: 3,
Grinch: 2,
Jumper: 1
}
puts "What would you like to do?"
choice = gets.chomp
case choice
@ArtBears
ArtBears / gist:5499798
Created May 2, 2013 02:29
Made the first one as anonymous, sorry! This is a program is my solution to a Google c++ problem with the following bounds: This is a number analogy to a famous card trick. Ask the user to enter a three-digit number. Think of the number as ABC (where A, B, C are the three digits of the number). Now, find the remainders of the numbers formed by A…
#include <iostream>
using namespace std;
int firstNumber(int x) // from left to right. Finds the number in the hundreds place.
{
int p, q;
p = x % 100;
q = ((x - p) / 100);
return q;