Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Implements hook_cron_queue_info().
*
* Define callback functions for queue items.
*/
function pc_rel_cron_queue_info() {
return array(
'cleanup_old_guardian_relationships' => array(
'worker callback' => 'pc_rel_cleanup_old_guardian_relationships',
$webapp = hiera('store_vhosts')
$user = $webapp['default']['webapp']['user']
$pass = $webapp['default']['webapp']['pass']
bcc_resque:
redis:
host: localhost
port: 6379
password:
@arturo-c
arturo-c / PerformLock.php
Last active August 29, 2015 14:05
Allow queueing but not performing php resque
<?php
/**
* @file
* Contains Drupal\resque\PerformLockPlugin.
*/
namespace Drupal\resque;
use Resque as Php_Resque;
use Resque_Job_DontPerform;
@arturo-c
arturo-c / bcc_resque.yaml
Created July 29, 2014 19:43
bcc resque config
bcc_resque:
redis:
host: localhost # the redis host
port: 6379 # the redis port
database: 1 # the redis database
app_root = ENV['DRUPALRESQUE_DIR'] || '/mnt/apci/drupal-resque'
num_workers = ENV['NUM_WORKERS'] || 2
queues = [
'PostMaster_General',
'PostMaster_Group',
'PostMaster_User',
'PostMaster_Send',
'PostMaster_Mail',
'PostMaster_PMessage',
'PostMaster_PMIndex',
1. Connect old drive to mac
diskutil list
2. Choose the disk
sudo dd if=/dev/disk{#} of=/Users/{your_user}/new_image.img bs=1024k
3. Eject old drive
4. Connect new drive
5. Unmount disk
sudo unmountDisk /dev/disk{#}
6. Restore from image
sudo dd if=/Users/{your_user}/new_image.img of=/dev/disk{#} bs=1024k
require 'resque'
namespace :resque do
desc "Clear pending tasks"
task :clear do
queues = Resque.queues
queues.each do |queue_name|
puts "Clearing #{queue_name}..."
Resque.redis.del "queue:#{queue_name}"
end
class User {
private $storage;
function __construct($storage) { // $storage is abstract, this is good
$this->storage = $storage;
}
function setLanguage($language) {
$this->storage->set($language);
}
}
@arturo-c
arturo-c / Vagrantfile
Last active August 29, 2015 14:01
Vagrantfile
Vagrant.configure('2') do |config|
config.vm.define 'apci' do |apci|
apci.vm.box = 'base'
apci.vm.network 'private_network', ip: '192.168.213.2'
apci.vm.provider :virtualbox do |vb|
vb.customize ['modifyvm', :id, '--memory', '2048']
vb.customize ['modifyvm', :id, '--cpus', '2']
vb.customize ['modifyvm', :id, '--ioapic', 'on']
end
apci.vm.host_name = 'vbox.apci.ws'