Skip to content

Instantly share code, notes, and snippets.

require 'nokogiri'
require 'open-uri'
# Get a Nokogiri::HTML:Document for the page we're interested in...
doc = Nokogiri::HTML(open('http://www.google.com/search?q=tenderlove'))
# Do funky things with it using Nokogiri::XML::Node methods...
####
@carolineartz
carolineartz / calculations.js
Last active May 24, 2023 00:03 — forked from dbc-challenges/calculations.js
Calculate the sum, mean, and median of an array in JavaScript
/*
Write THREE functions: sum, mean, and median. Each accepts an array
and returns its respective calculation.
Below you will find driver code. Run the code in this file either from the command line
using Node.js or by pasting the code of this entire file into your
browser console. All tests will log 'true' in the console when
they pass--false, otherwise.
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'

Originally published in June 2008

When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.

To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.

What to expect

Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.

@carolineartz
carolineartz / cub-n-pup-puzzle-game-demo.markdown
Created December 11, 2017 15:45
Cub n Pup - puzzle game demo

Cub n Pup - puzzle game demo

How to play: Drag cub to star, Drag grid to rotate.

Also available at cubnpup.com

This is a proof-of-concept for a game. Basic art, no sound, no options, no polish. But the core game-play is there. It's more of a mobile game, focused on dragging — inspired by Threes. I'm looking to see if its any fun. Let me know!

I've always wanted to make a video game. This could be the one. My previous attempts never got past isolated demos because they were aiming for bigger ideas. They grew complex and unwieldy. So this game is designed to be simple. A game that I can actually make.

@carolineartz
carolineartz / lighten-darken.js
Created March 7, 2014 18:25
Lighten/Darken The CSS preprocessors Sass and LESS can take any color and darken() or lighten() it by a specific value. But no such ability is built into JavaScript. This function takes colors in hex format (i.e. #F06D06, with or without hash) and lightens or darkens them with a value. From http://css-tricks.com/snippets/javascript/lighten-darke…
function LightenDarkenColor(col, amt) {
var usePound = false;
if (col[0] == "#") {
col = col.slice(1);
usePound = true;
}
var num = parseInt(col,16);
module Direct
# Models that include this mixin must
# - have a `cancelled_at` column
# - implement paranoia with `deleted_at` column
# To use this mixin, include the module and call the macro
# The macro takes options hash that will be forwarded on,
# to an after_destroy callback. Typically passing a conditional
# `if` or `unless` would be appropriate.
#
#
/*
github.com style (c) Vasily Polovnyov <vast@whiteants.net>
*/
.hljs {
display: block; padding: 0.5em;
color: #333;
background: #f8f8f8
@carolineartz
carolineartz / documents.rb
Last active July 19, 2019 16:44 — forked from dhh/documents.rb
dhh Rails resource example
# config/routes.rb
resources :documents do
scope module: 'documents' do
resources :versions do
post :restore, on: :member
end
resource :lock
end
end
<!DOCTYPE html>
<html>
<body>
<h2>Polyfill.io "Holy grail" approach</h2>
<p id='result'>Polyfills are loading…</p>
<p>See the JavaScript tab for details. This approach:</p>