Skip to content

Instantly share code, notes, and snippets.

@kiafaldorius
kiafaldorius / active_record_sqlite_in_memory_db.rb
Created September 3, 2018 03:05 — forked from thomasklemm/active_record_sqlite_in_memory_db.rb
Awesome ActiveRecord bug report script. How to use ActiveRecord and SQLite in a Ruby script.
# Based on http://www.jonathanleighton.com/articles/2011/awesome-active-record-bug-reports/
# Run this script with `$ ruby my_script.rb`
require 'sqlite3'
require 'active_record'
# Use `binding.pry` anywhere in this script for easy debugging
require 'pry'
# Connect to an in-memory sqlite3 database
@kiafaldorius
kiafaldorius / debug data
Last active December 16, 2015 04:48
Multipart ACL seems to not work... I'm on "HA-Proxy version 1.4.18 2011/09/16" manually compiled on Mac OSX Snow Leopard
00000000:http.accept(0003)=0004 from [127.0.0.1:49647]
00000000:http.clireq[0004:ffff]: POST /upload.json HTTP/1.1
00000000:http.clihdr[0004:ffff]: Host: localhost:9090
00000000:http.clihdr[0004:ffff]: Connection: keep-alive
00000000:http.clihdr[0004:ffff]: Content-Length: 201199
00000000:http.clihdr[0004:ffff]: Cache-Control: max-age=0
00000000:http.clihdr[0004:ffff]: Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
00000000:http.clihdr[0004:ffff]: Origin: null
00000000:http.clihdr[0004:ffff]: User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31
00000000:http.clihdr[0004:ffff]: Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryW77NGtHaHWUON4G7
@kiafaldorius
kiafaldorius / project_create.php
Created August 1, 2012 11:09
Kanbanpad PHP Example
<?php
# Example create project on kanbanpad api using json
# Runs on PHP 5.3 with curl and json extension
# Note the https, the s is required.
$curl = curl_init("https://www.kanbanpad.com/api/v1/projects.json");
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, 'kiafaldorius+open@gmail.com:e754f5335230f9bad9b5dc90ceb5ab0c76a06604');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, 1);
@kiafaldorius
kiafaldorius / gist:744654
Created December 17, 2010 08:12
This class lets you enqueue class methods with Delayed Job
# This class lets you enqueue class methods with Delayed Job
# For Rails, name this delayed_profit.rb and put it in your app/models directory
# For the others, do what you do to load files
# Usage: Assuming Notifier is your ActionMailer class then ...
# Delayed::Job.enqueue DelayedProfit.new(Notifier,
# :deliver_profit_notification, 'hey!', 'we profitted')
# This causes Delayed Job to execute
# Notifier.deliver_profit_notification('hey!', 'we profitted')
class DelayedProfit