Skip to content

Instantly share code, notes, and snippets.

View bartolsthoorn's full-sized avatar

Bart Olsthoorn bartolsthoorn

View GitHub Profile
CGRect newFrame = CGRectMake(_menuView.frame.size.width*-1, _menuView.frame.origin.y, _menuView.frame.size.width, _menuView.frame.size.height);
_menuView.frame = CGRectMake(0, _menuView.frame.origin.y, _menuView.frame.size.width, _menuView.frame.size.height);
[UIView animateWithDuration:0.5
animations:^{
_menuView.frame = newFrame;
}];
@bartolsthoorn
bartolsthoorn / sidekiq.god
Last active December 14, 2015 08:28
This god recipe keeps starting up sidekiq processes every 5~10 seconds, but why?
God.watch do |w|
pid_file = "#{RAILS_ROOT}/tmp/pids/sidekiq.pid"
w.name = 'sidekiq'
w.interval = 30.seconds
w.start = "cd #{RAILS_ROOT} && RAILS_ENV=#{RAILS_ENV} bundle exec sidekiq -C #{RAILS_ROOT}/config/sidekiq.yml -P #{pid_file} -e #{RAILS_ENV} -L #{RAILS_ROOT}/log/sidekiq.log -d"
w.stop = "bundle exec sidekiqctl quiet #{pid_file}"
w.start_grace = 10.seconds
# restart if memory gets too high
Failure/Error: Net::HTTP.get_response(URI.parse('http://google.com')).code.should == 301
ArgumentError:
cannot interpret as DNS name: nil
# /Users/bartolsthoorn/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/resolv.rb:1176:in `create'
# /Users/bartolsthoorn/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/resolv.rb:1022:in `generate_candidates'
# /Users/bartolsthoorn/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/resolv.rb:1047:in `resolv'
# /Users/bartolsthoorn/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/resolv.rb:513:in `each_resource'
# /Users/bartolsthoorn/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/resolv.rb:406:in `each_address'
# /Users/bartolsthoorn/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/resolv.rb:115:in `block in each_address'
# /Users/bartolsthoorn/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/resolv.rb:114:in `each'
Failure/Error: Net::HTTP.get_response(URI.parse('http://google.com')).to_i.should == 301
ArgumentError:
cannot interpret as DNS name: nil
@bartolsthoorn
bartolsthoorn / Capfile
Last active December 14, 2015 01:19
rvm-capistrano settings
require 'rvm/capistrano'
set :rvm_bin_path, '/usr/local/rvm/bin'
set :rvm_path, '/usr/local/rvm'
set :rvm_ruby_string, '1.9.3-p385'
@bartolsthoorn
bartolsthoorn / a.rb
Last active December 12, 2015 04:19
Chrome Webdriver, lose connection => lose RAM!
require 'selenium-webdriver'
client = Selenium::WebDriver::Remote::Http::Default.new
client.timeout = 1 # seconds
driver = Selenium::WebDriver.for(
:chrome,
:http_client => client,
:switches => %w[--ignore-certificate-errors --disable-popup-blocking --disable-translate]
)
class A
class B
class C
def foo
puts "Boo"
end
end
end
end
//
// NVHighpassFilter.h
// NVDSP
//
// Created by Bart Olsthoorn on 18/05/2012.
// Copyright (c) 2012 Bart Olsthoorn. All rights reserved.
//
#import "NVDSP.h"
//
// NVHighpassFilter.m
// NVDSP
//
// Created by Bart Olsthoorn on 18/05/2012.
// Copyright (c) 2012 Bart Olsthoorn. All rights reserved.
//
#import "NVHighpassFilter.h"
// MULTIPLE SIGNAL GENERATOR!
__block float *phases = nil;
[audioManager setOutputBlock:^(float *data, UInt32 numFrames, UInt32 numChannels)
{
float samplingRate = audioManager.samplingRate;
NSUInteger activeSignalCount = [tones count];
// Initialize phases
if (phases == nil) {
phases = new float[10];