Skip to content

Instantly share code, notes, and snippets.

@dmitriy-kiriyenko
dmitriy-kiriyenko / active_model_lint.rb
Created February 23, 2012 13:37
ActiveModel lint tests for rspec
# put the file into spec/support
shared_examples_for "ActiveModel" do
include ActiveModel::Lint::Tests
# to_s is to support ruby-1.9
ActiveModel::Lint::Tests.public_instance_methods.map{|m| m.to_s}.grep(/^test/).each do |m|
example m.gsub('_',' ') do
send m
end
end
@James1x0
James1x0 / emberscrollspy.js
Last active January 30, 2017 17:28
Ember Scrollspy
import Ember from 'ember';
import windowBinderMixin from '../mixins/window-binder';
export default Ember.View.extend(windowBinderMixin, {
templateName: 'scroll-spy',
classNames: [ 'scroll-spy-view', 'affix' ],
// Bind the window events on view insertion
didInsertElement: function () {
this.setupWindowBindings();
@giantryansaul
giantryansaul / install_jupyter_notebook_on_aws.md
Created December 14, 2015 05:35
Run Jupyter from an amazon free tier AWS server

Installing Jupyter notebook to AWS

This is an early draft of this guide, which currently does not include any screenshots. I may be making a lot of assumptions about what you do or do not know in this guide and so I welcome any constructive criticism to help make it more useful. Please feel free to fork this guide and annotate it where it does not work, I would welcome any pull requests to improve this documentation.

Setup amazon linux server (free tier)

  • From Amazon's EC2 page, go to Launch Instance
  • Choose an Amazon Linux 64-bit server and continue
  • Select t2.micro (this is the free tier)
  • Continue to the Add Storage page and adjust this up to 30GB if you're so inclined (default is 8GB, which is plenty)
  • Tag your instance with a name like "notebook"
@dwhacks
dwhacks / speed.txt
Created January 27, 2014 07:07
speed equation tetris
For speed I used the formula:
delay = 725 * .85 ^ level + level
Where delay is the time (in milliseconds) before the block falls one row -- That equation reaches its minimum at level 30 (35.5 ms delay) and begins to climb again until delay = level (basicly the game slows down about 6ms per drop by level 41). However, I was modeling a certain behavior, and you might have better performance with a more general equation:
delay = delay_at_level_0 / (level + 1)
Where delay_at_level_0 is a constant
@ericrobskyhuntley
ericrobskyhuntley / README.md
Last active March 22, 2020 00:26 — forked from rgdonohue/README.md
Batch Geocoding Script with GeoPy
.-"-._( ) )
/ , , 66\
`======\ )_\\=\_o)=
`~~"~ `"
@shentonfreude
shentonfreude / dynamodb_read_backoff.py
Created December 11, 2015 17:00
Wrap boto3 dynamodb in an exponential backoff to avoid ProisionedThroughputExceededException
#!/usr/bin/env python
# An exponential backoff around Boto3 DynamoDB, whose own backoff eventually
# fails on long multipage scans. We'd like to use this as a wrapper somehow,
# see: https://gist.github.com/numberoverzero/cec21b8ca715401c5662
from time import sleep
import boto3
from boto3.dynamodb.conditions import Attr
@derEremit
derEremit / gource-multiple-repositories.sh
Created November 8, 2011 14:58 — forked from anonymous/gource-multiple-repositories.sh
Generates gource video out of multiple repositories.
#!/usr/bin/env bash
# Generates gource video (h.264) out of multiple repositories.
# Pass the repositories in command line arguments.
# Example:
# <this.sh> /path/to/repo1 /path/to/repo2
RESOLUTION="1600x1080"
outfile="gource.mp4"
i=0
@oscarmorrison
oscarmorrison / missing-image.html
Created June 4, 2016 03:38
html backup image
<img src="img/missing-image.png" onerror="javascript:this.src='img/default.png'">
@gbuesing
gbuesing / ml-ruby.md
Last active February 28, 2024 15:13
Resources for Machine Learning in Ruby

UPDATE a fork of this gist has been used as a starting point for a community-maintained "awesome" list: machine-learning-with-ruby Please look here for the most up-to-date info!

Resources for Machine Learning in Ruby

Gems