Skip to content

Instantly share code, notes, and snippets.

View danieljohnmorris's full-sized avatar
😀

Daniel Morris danieljohnmorris

😀
View GitHub Profile
@christophermanning
christophermanning / README.md
Last active March 30, 2023 04:24
Voronoi Diagram with Force Directed Nodes and Delaunay Links

Created by Christopher Manning

Summary

Nodes are linked to nodes in neighboring cells. The cell's color is a function of its area.

The white lines are the Delaunay triangulation and the purple cells are the Voronoi diagram.

Controls

@gcatlin
gcatlin / gist:1847248
Created February 16, 2012 19:43
Install specific version of Homebrew formula
brew update
brew versions FORMULA
cd `brew --prefix`
git checkout HASH Library/Formula/FORMULA.rb # use output of "brew versions"
brew install FORMULA
brew switch FORMULA VERSION
git checkout -- Library/Formula/FORMULA.rb # reset formula
## Example: Using Subversion 1.6.17
#
@them0nk
them0nk / rspec_rails_cheetsheet.rb
Created March 23, 2012 03:39
Rspec Rails cheatsheet (include capybara matchers)
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
@arirusso
arirusso / video-example.rb
Created March 27, 2012 23:54
ruby-processing: video processing example
#!/usr/bin/env ruby
# this is a test of ruby-processing (https://github.com/jashkenas/ruby-processing) with the video library
# use "rp5 unpack library" at a command line to install the video library, among others
# tested with Ruby 1.9.2
# video file: http://bit.ly/H5yBjK
class VideoTest < Processing::App
@romanbsd
romanbsd / stathat.rb
Created May 22, 2012 13:11
Stathat API using Faraday
require 'faraday'
module StatHat
module API
extend self
CLASSIC_VALUE_URL = "http://api.stathat.com/v".freeze
CLASSIC_COUNT_URL = "http://api.stathat.com/c".freeze
EZ_URL = "http://api.stathat.com/ez".freeze
def post_value(stat_key, user_key, value)
@dennysfredericci
dennysfredericci / validator
Created July 2, 2012 03:56
An easy way to use JQuery Validation with Twitter Bootstrap Popover
$('form').validate(
{
rules: {
numero: {
required: true
},
descricao: {
minlength: 3,
email: true,
required: true
@danieljohnmorris
danieljohnmorris / artist_cowboy_antics.rb
Last active December 15, 2015 04:28
In Ruby you can be an artist and a cowboy, after all!
class Person
attr_accessor :pocket
end
class Artist < Person
def draw_like_an_artist
"Look, I painted a landscape."
end
end
@joncode
joncode / gist:6274015
Last active December 21, 2015 07:49
Attachinary how to add ...

Setup


  1. add the cloudinary and attachinary Rails 4 gems

    gem 'cloudinary'

    gem 'attachinary', git: 'git://github.com/rochers/attachinary.git', branch: 'rails4'

<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Stripe Getting Started Form</title>
<!-- The required Stripe lib -->
<script type="text/javascript" src="https://js.stripe.com/v2/"></script>
<!-- jQuery is used only for this example; it isn't required to use Stripe -->
@elithrar
elithrar / stripe-config.js
Created November 27, 2013 00:40
Example Stripe Checkout - Custom Integration for #stripe
// Disable the payment/submit button until everything has loaded
// (if Stripe fails to load, we can't progress anyway)
$(document).ready(function() {
$("#payment-button").prop('disabled', false)
})
var handler = StripeCheckout.configure("customButtonA", {
key: '<yourpublishablekey',
token: function(token, args){
var $input = $('<input type=hidden name=stripeToken />').val(token.id);