Skip to content

Instantly share code, notes, and snippets.

@sixty4bit
sixty4bit / oracle_1000_ids_test.rb
Created November 10, 2011 19:30
Oracle can't handle more than 1000 values in an IN clause
require 'rubygems'
gem 'activerecord', '3.0.4'
gem 'activerecord-oracle_enhanced-adapter', '1.4.0'
require 'active_record'
ActiveRecord::Base.establish_connection( :adapter => 'oracle_enhanced', :database => 'orcl',
:username => 'hr', :password => 'hr')
ActiveRecord::Base.connection.instance_eval do
drop_table :jobs rescue nil
@sixty4bit
sixty4bit / skuify_shopify.rb
Last active August 18, 2017 02:04
Assign SKUs to Shopify Products
require 'shopify_api'
API_KEY = 'enteryourkeyhere'
PASSWORD = 'enteryourpasswordhere'
SHOP_NAME = 'yourshopname'
shop_url = "https://#{API_KEY}:#{PASSWORD}@#{SHOP_NAME}.myshopify.com/admin"
ShopifyAPI::Base.site = shop_url
i = 11211316 # start with ab1234
product_count = ShopifyAPI::Product.count
cpu_available = 5
Order.includes(:products).find_in_batches do |batch|
batch.in_groups(cpu_available, false) do |group|
Process.fork do
Sunspot.index! group
end
end
Process.waitall
end
batches = Queue.new
Order.select(:id).find_in_batches do |batch|
batches << batch.map(&:id)
end
cpu_available.times do
Thread.new do
while(ids = batches.pop)
pid = Process.fork do
Sunspot.index! Order.includes(:product).find(ids)
end
@sixty4bit
sixty4bit / gist:8f7da22083f3f2ceb79c7c2fbbec3ae2
Created December 2, 2023 16:05 — forked from levelsio/gist:5bc87fd1b1ffbf4a705047bebd9b4790
Secret of Monkey Island: Amsterdam (by @levelsio) or how to create your own ChatGPT image+text-based adventure game
# 2023-11-27 MIT LICENSE
Here's the open source version of my ChatGPT game MonkeyIslandAmsterdam.com.
It's an unofficial image+text-based adventure game edition of Monkey Island in Amsterdam, my home town.
Please use it however you want. It'd be nice to see more ChatGPT-based games appear from this. If you get inspired by it, please link back to my X https://x.com/levelsio or this Gist so more people can do the same!
Send me your ChatGPT text adventure game on X, I'd love to try it!