Skip to content

Instantly share code, notes, and snippets.

from sqlalchemy import event
@event.listens_for(Issue, 'after_insert')
def receive_after_insert(mapper, connection, target):
# Do something with target
print "Running"
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network "private_network", ip: "192.168.33.33"
config.vm.provider :virtualbox do |vb|
vb.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]
vb.gui = false
This issue is being closed as it is more than 12 months old. If you are
still experiencing this problem and wish to help investigate further,
please feel free to re-open it.
directions = { :N => lambda {y_coord++}, :S => lambda {y_coord--} }
directions[:N].call
def my_function
puts "Ross is very cool"
end
my_map = { :ross => method(:my_function) }
my_map[:ross].call
@rossjones
rossjones / tostruct.exs
Last active September 14, 2015 18:58
Convert node found at end of XPATH to an Elixir struct.
#!/usr/bin/env elixir
defmodule Helper do
def title_case(str) do
{first, rest} = String.split_at(str, 1)
first <> String.downcase(rest)
end
end
defmodule XmlNode do
paster packagezip init -c $CKAN_INI
Traceback (most recent call last):
File "/home/co/ckan/bin/paster", line 9, in <module>
load_entry_point('PasteScript==1.7.5', 'console_scripts', 'paster')()
File "/home/co/ckan/local/lib/python2.7/site-packages/paste/script/command.py", line 103, in run
command = commands[command_name].load()
File "/home/co/ckan/local/lib/python2.7/site-packages/pkg_resources.py", line 2108, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/vagrant/src/ckanext-packagezip/ckanext/packagezip/commands.py", line 10, in <module>
from ckan.lib.celery_app import celery
  1. Change your schema and templates and so forth to have package_create and package_update store your domain field.
  2. In your IDomainObjectNotification, you'll get an object called entity which is a package model from ckan/model/package.py
  3. You can find the groups for this package using get_groups()
  4. You can add the package to a group by calling add_package_by_name on the group object.
  5. If you find the domain property isn't available in package.extras.get('domain') then you may need to use notify_after_commit
import pylons
pylons.session['ckanext-persona-user'] = 'new-user-name'