Skip to content

Instantly share code, notes, and snippets.

View aantix's full-sized avatar

Jim Jones aantix

View GitHub Profile
@aantix
aantix / generate_leads.sh
Created August 19, 2012 06:38
Rails : script/runner with rvm called from cron
#!/usr/bin/env bash
source /usr/local/rvm/environments/ruby-1.9.2-p318@action_traction
cd /var/www/action_traction/current
script/rails runner -e production "LeadSearch.generate_leads" 2>&1 >> /var/www/action_traction/current/log/generate_leads.log
@aantix
aantix / zeus_rubymine.txt
Last active December 25, 2015 05:39
Running tests under Zeus for Rubymine 6.0 momiji EAP
If you want to run individual specs under Zeus & the latest Rubymine EAP
* Ensure that you install the latest Zeus
gem install zeus --version=0.13.4.pre2
* Remove the following lines from spec_helper if they exist
require 'rspec/autorun'
require 'rspec/autotest'
* Set the default to zeus for rspec
@aantix
aantix / gist:1999816
Created March 8, 2012 09:08
Remote Pair Programming sucks. Here's how to solve it.

REAL WORLD SCENARIO (blinking lights)

Mr. Tom Dev wants to remote pair program with Mr. Todd Programmer. Tom is in New York, Todd is in San Francisco. They’re working on yet another blog written in Ruby. Tom fires up Rubymine, Todd fires up TextMate.

Todd’s editor quickly alerts him that he is connected with Tom and that their projects are out of sync. The plugin gives them each the option of using Tom’s file versions, Todd’s files, or performing a git pull request. They both do a git pull and are back in sync.

Todd quickly opens the User model in Rubymine with cmd-shift-N and Todd quickly sees that same file opened in Textmate. Todd then highlights a method that has been failing a test and Tom sees that highlight. Todd makes the change to the file, clicks cmd-s, and that file change is synced over to Tom.

Tom thought there was a secondary change needed in the Profile model, so he hits cmd-T, opens the Profile model and Todd sees that file opened in Rubymine. Todd tells Tom that he’s smoking catn

require 'rugged'
require 'time'
require 'active_support/all'
DATE_FORMAT = "%-m/%-d/%Y"
puts "repo = #{ARGV[0]}"
puts "branch = #{ARGV[1]}"
puts "email = #{ARGV[2]}"
puts '=========================='
@aantix
aantix / the-mad-chatter.txt
Last active April 19, 2019 15:31
Documentation for The Mad Chatter - A Novell Network based chat system. 95-96.
T H E
€€€ª €€€ª €€€€€ª €€€€€€ª
€€€€ª €€€€∫ €€…ÕÕ€€ª €€…ÕÕ€€ª
€€…€€€€…€€∫ €€€€€€€∫ €€∫ €€∫
€€∫»€€…º€€∫ €€…ÕÕ€€∫ €€∫ €€∫
€€∫ »Õº €€∫ €€∫ €€∫ €€€€€€…º
»Õº »Õº »Õº »Õº »ÕÕÕÕÕº
€€€€€€ª €€ª €€ª €€€€€ª €€€€€€€€ª €€€€€€€€ª €€€€€€€ª €€€€€€ª
Donald D Freeman Tech Infrastructure Coordinator 115757.00
Lea Ann Johnson Grant Coordinator 105913.00
Kristi L Peters Training/support Coordinator 102089.00
Darin W Raguse Technology Services Coordinator 101417.00
Kimberly K Samuelson Coordinator 97810.33
Tonya L Jolley Coordinator 95847.20
Jill L Bird Coordinator 95321.12
Barbara A Fitzgerald Coordinator 93240.12
Laura A Runge Coordinator 92616.63
Jane L Bozek Coordinator 89934.04
@aantix
aantix / rails_all_app_model_modules_classes.rb
Last active September 24, 2022 16:10
Getting all Rails application level classes and modules
Zeitwerk::Loader.eager_load_all && true
objs = []
ObjectSpace.each_object(Module){|ob| objs << [ob, ((Object.const_source_location(ob.to_s) rescue nil) || (Module.const_source_location(ob.to_s) rescue nil))]}
objs.reject!{|o| !(o&.last&.first =~ /#{Rails.root.to_s}/)}
objs = objs.collect{|c| c.flatten.first}
objs
module Y
def hello(str)
puts "prepended before super"
super(str)
puts "prepended after super"
end
end
class X
def hello(str)
@aantix
aantix / mp4_to_gif.sh
Created May 5, 2023 14:20
Convert mp4 video to optimized gif
#!/bin/bash
# https://www.bannerbear.com/blog/how-to-make-a-gif-from-a-video-using-ffmpeg/
# Mac OSX
# brew install ffmpeg
# brew install gifsicle
echo "Extracting the palette."
ffmpeg -i $1 -filter_complex "[0:v] palettegen" palette.png
@aantix
aantix / 2_ollama.rb
Last active April 2, 2024 12:46
Easy LLM setup for Ruby on Rails application
class Ollama
URL = 'http://localhost:11434/api/chat'
def initialize
@uri = URI.parse(URL)
end
def prompt(question)
response = Net::HTTP.start(@uri.hostname, @uri.port, use_ssl: @uri.scheme == 'https') do |http|
http.post(@uri, JSON.dump({