Skip to content

Instantly share code, notes, and snippets.

View iRonin's full-sized avatar

Cyprian Kowalczyk iRonin

View GitHub Profile
@iRonin
iRonin / deployments.rake
Created September 6, 2012 07:05 — forked from neilmiddleton/deployments.rake
Integrates CodebaseHQ deployment notifications into Heroku-san
desc 'After_deploy callback'
task :before_deploy => :environment do |t, args|
username = `git config codebase.username`.chomp.strip
api_key = `git config codebase.apikey`.chomp.strip
if username == '' || api_key == ''
puts " * Codebase is not configured on your computer. Bundle the codebase gem and run 'codebase setup' to auto configure it."
puts " * Deployments will not be tracked."
next
@iRonin
iRonin / HOWTO.md
Created February 19, 2019 14:04 — forked from cvan/HOWTO.md
get all URLs of all network requests made on a web page from the Chrome Dev Tools (from an exported HAR)

Setup

Using Homebrew on Mac OS X:

brew install jq

Add these aliases to your profile (e.g., ~/.zshrc, ~/.bashrc, ~/.profile, etc.):

alias hurlp='pbpaste | jq ".log.entries" | tee >(jq --raw-output "[.[] | .request.url] | sort | unique | .[]")'

alias hurld='pbpaste | jq ".log.entries" | jq --raw-output "[.[] | .request.url] | sort | unique | .[]" | tee >(xargs -n 1 curl -O $1)'

@iRonin
iRonin / README.md
Created January 17, 2014 17:56 — forked from slindberg/README.md

Ember.Console

This is a set of helpers for finding the application's currently active models/routes/controllers/etc. This isn't a straightforward process because of how Ember (rightly) encapsulates application objects, but it's useful in debugging environments to be able to quickly access them. And with the beta release of Ember Data, the store is not easily accessible without helpers either.

Usage

All helpers can be called directly if you provide them an application instance:

#!/usr/bin/env ruby
require "openssl"
class BF < Struct.new(:key, :pad_with_spaces)
def encrypt(str)
cipher = OpenSSL::Cipher.new('bf-ecb').encrypt
if pad_with_spaces
str += " " until str.bytesize % 8 == 0
cipher.padding = 0
@iRonin
iRonin / spec_helper_with_headless_chrome.rb
Created September 17, 2012 08:53 — forked from jumski/spec_helper_with_headless_chrome.rb
rspec around hook for runnign selenium_chrome with headless gem in capybara
c.around(:each, :js => true) do |example|
if Capybara.current_driver == :chrome
headless = Headless.new
headless.start
end
@iRonin
iRonin / receipt
Created September 14, 2012 08:24 — forked from sauloarruda/receipt
Apple iOS in app purchase validate receipt in Ruby
ewoJInNpZ25hdHVyZSIgPSAiQXBNVUJDODZBbHpOaWtWNVl0clpBTWlKUWJLOEVk
ZVhrNjNrV0JBWHpsQzhkWEd1anE0N1puSVlLb0ZFMW9OL0ZTOGNYbEZmcDlZWHQ5
aU1CZEwyNTBsUlJtaU5HYnloaXRyeVlWQVFvcmkzMlc5YVIwVDhML2FZVkJkZlcr
T3kvUXlQWkVtb05LeGhudDJXTlNVRG9VaFo4Wis0cFA3MHBlNWtVUWxiZElWaEFB
QURWekNDQTFNd2dnSTdvQU1DQVFJQ0NHVVVrVTNaV0FTMU1BMEdDU3FHU0liM0RR
RUJCUVVBTUg4eEN6QUpCZ05WQkFZVEFsVlRNUk13RVFZRFZRUUtEQXBCY0hCc1pT
QkpibU11TVNZd0pBWURWUVFMREIxQmNIQnNaU0JEWlhKMGFXWnBZMkYwYVc5dUlF
RjFkR2h2Y21sMGVURXpNREVHQTFVRUF3d3FRWEJ3YkdVZ2FWUjFibVZ6SUZOMGIz
SmxJRU5sY25ScFptbGpZWFJwYjI0Z1FYVjBhRzl5YVhSNU1CNFhEVEE1TURZeE5U
SXlNRFUxTmxvWERURTBNRFl4TkRJeU1EVTFObG93WkRFak1DRUdBMVVFQXd3YVVI
@iRonin
iRonin / after.rb
Created September 12, 2012 08:16 — forked from mperham/after.rb
Thread-friendly shared connection
class ActiveRecord::Base
mattr_accessor :shared_connection
@@shared_connection = nil
def self.connection
@@shared_connection || ConnectionPool::Wrapper.new(:size => 1) { retrieve_connection }
end
end
ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection
class ApplicationController < ActionController::Base
...
# FORCE to implement content_for in controller
def view_context
super.tap do |view|
(@_content_for || {}).each do |name,content|
view.content_for name, content
end
end
end
@iRonin
iRonin / gist:3189378
Created July 27, 2012 17:58 — forked from hipertracker/gist:214210
NGinx -> TorqueBox
/etc/hosts:
127.0.0.1 myhost jboss_server
NGINX:
server {
listen myhost:80;
server_name myhost;
location / {
proxy_set_header X-Real-IP $remote_addr;
//////////////////////push_notifications.js///////////////////////
var apns = function(){
var pref = require('preferences').preferences;
Titanium.Network.registerForPushNotifications({
types: [
Titanium.Network.NOTIFICATION_TYPE_BADGE,
Titanium.Network.NOTIFICATION_TYPE_ALERT
],
success:function(e)