Skip to content

Instantly share code, notes, and snippets.

View codenamev's full-sized avatar
🌩️

Valentino Stoll codenamev

🌩️
View GitHub Profile
@glen-cheney
glen-cheney / encoding-video.md
Last active November 24, 2024 10:09
Encoding video for the web

Encoding Video

Installing

Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus
@gbuesing
gbuesing / ml-ruby.md
Last active June 6, 2025 20:52
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

@lfender6445
lfender6445 / gist:9919357
Last active May 13, 2025 16:00
Pry Cheat Sheet

Pry Cheat Sheet

Command Line

  • pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru)
  • pry -r ./config/environment.rb - load your rails into a pry session

Debugger

@emad-elsaid
emad-elsaid / twitter-thanks.rb
Created February 27, 2014 10:21
create a thanks for following me twitter bot using ruby
#!/usr/bin/env ruby
require 'Twitter'
# Create a read write application from :
# https://apps.twitter.com
# authenticate it for your account
# fill in the following
config = {consumer_key: '', consumer_secret: '',
access_token: '', access_token_secret: ''}
me = 'Blaze Boy' # to prevent DM yourself
@codenamev
codenamev / page_object.rb
Last active October 26, 2016 12:30
Simple base class implementing "Page Objects" as referenced: http://gaslight.co/blog/6-ways-to-remove-pain-from-feature-testing-in-ruby-on-rails
class PageObject
include Capybara::DSL
include RSpec::Matchers
include Rails.application.routes.url_helpers
attr_accessor :path, :object
def initialize(object = nil)
raise "#{self.class} must be initialized with a model instance" unless !is_singular_object_page? or object
@path = "#{path_name}_path"
@danharper
danharper / background.js
Last active April 29, 2025 04:09
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});
@blacktm
blacktm / install_ruby_rpi.sh
Last active November 28, 2024 20:35
A Bash script to install Ruby on the Raspberry Pi
#!/bin/bash
# --------------------------------------------------------------------------------------------
# Installs Ruby using rbenv/ruby-build on the Raspberry Pi (Raspbian)
#
# Run from the web:
# bash <(curl -s https://gist.githubusercontent.com/blacktm/8302741/raw/install_ruby_rpi.sh)
# --------------------------------------------------------------------------------------------
# Set the Ruby version you want to install
@kalmanh
kalmanh / converter_script.rb
Last active October 24, 2016 19:34
Ruby script to convert .mdb db file into .csv
# Export data from Microsoft Access .mdb database into .csv files
# using https://github.com/brianb/mdbtools
# Install with homebrew - "brew install mdbtools"
class ConverterScript
tables = `mdb-tables -d , your_db_name.mdb`.chop.split(",")
tables.each do |table|
exists = system("mdb-export your_db_name.mdb '#{table}'")
`mdb-export your_db_name.mdb '#{table}' > #{table.gsub(" ", "_")}.csv` if exists
@britishtea
britishtea / dependency.rb
Last active March 30, 2017 19:43
A null object in Ruby with refinements
module Dependency
def self.give_me_the_nil
nil
end
end
@ndarville
ndarville / business-models.md
Last active June 13, 2025 01:26
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google