Skip to content

Instantly share code, notes, and snippets.

View dergachev's full-sized avatar

Alex Dergachev dergachev

View GitHub Profile

Poor man's node_export, aka node smuggling

I needed to create a new webform on a production site recently. But as a dev, I don't have direct access to the production admin backend; I'm only allowed to push code changes and let the client's team migrate them to prod via drush updb. So I'm supposed to export the webform configuration to code, and deploy it via an update hook, but how?

Because webform nodes are content not configuration, the Features module doesn't help. We generally use the Migrate module with CSVs for content staging, but the thought of exporting arbitrary webform config to CSV gives me the heebie jeebies. The happy medium is node_export, that old-school module that gives a simple UI to export, copy-and-paste, and import a node's configuration across two sites. And using it would work, but would require maintaining its 30

array (
'nid' => '27',
'next_serial' => '1',
'confirmation' => '',
'confirmation_format' => NULL,
'redirect_url' => '<confirmation>',
'status' => '1',
'block' => '0',
'allow_draft' => '0',
'auto_save' => '0',
---
after:
url: https://gist.github.com/dergachev/a3cf9fe176b1a0b949cf
sanitization:
- title: Strip domain names from absolute URLs
pattern: http:\/\/[a-zA-Z0-9.:-]+
substitute: __domain__
disabled: true
paths:
- /
<!DOCTYPE html><html manifest="/_/chrome/newtab/manifest?espv=2&amp;ie=UTF-8" lang="en-CA"><head><style>.cta{}.default-theme{}#dood{}.fkbx{}#fkbx-hht{}.fkbx-hht-s{}#fkbx-text{}.hide-sf{}.init{}.light-text{}.mv-dot{}.mv-dot-bg{}.mv-focused{}.mv-link-hide{}.mv-locthumb{}.mv-locgradient{}.mv-loctitle{}.mv-locfallback{}.mv-tiles{}.mv-x{}.mv-x-inner{}.prm-pt{}.prm{}.prt{}.pt{}@-webkit-keyframes init-hide {0%{opacity:0}99%{opacity:0}100%{opacity:1}}body{font:small arial,sans-serif;margin:0;min-height:616px;text-align:-webkit-center}body.hide,body.hide-sf #fkbx,body.hide-sf #lga{visibility:hidden}body.init{-webkit-animation:init-hide 0.5s linear}#lga.init,#fkbx.init{-webkit-animation:init-hide 2s linear}a{color:#12c;text-decoration:none}a:hover,a:active{text-decoration:underline}a:visited{color:#609}#most-visited{-webkit-user-select:none;z-index:1}#mv-tiles{margin:0;overflow:hidden;position:relative;text-align:start}.mv-tile{-webkit-transition-duration:200ms;-webkit-transition-property:-webkit-transform,margin,opac
@dergachev
dergachev / evolvingweb-1080.yml
Created December 9, 2014 19:36
sitediff-config for evolvingweb
before_url: http://evolvingweb.ca
after_url: http://docker-host.tree.ewdev.ca:5027
paths:
- /
- /user
- /about-evolvingweb
- /contact-us
- /training
- /blog
@dergachev
dergachev / redmine_repository_fetch.rb
Created December 3, 2014 22:59
Initial draft for redmine_git_remote, deprecated; see https://github.com/dergachev/redmine_git_remote
# initial draft for redmine_git_remote, deprecated
module RepositoryFetch
def self.logger
::Rails.logger
end
PATTERNS = [
{ :pattern => "/redmine_git_fetch/github.com/",
:uri_prefix => "git@github.com:",

BabelFrog, and Writing Chrome Extensions

About BabelFrog

  • Demo
  • Why I wrote it
diff --git a/app/views/issues/show.rhtml b/app/views/issues/show.rhtml
index cfe0288..b8fffa0 100644
--- a/app/views/issues/show.rhtml
+++ b/app/views/issues/show.rhtml
@@ -25,11 +25,29 @@
<th class="due-date"><%=l(:field_due_date)%>:</th><td class="due-date"><%= format_date(@issue.due_date) %></td>
</tr>
<tr>
- <th class="assigned-to"><%=l(:field_assigned_to)%>:</th><td class="assigned-to"><%= avatar(@issue.assigned_to, :size => "14") %><%= @issue.assigned_to ? link_to_user(@issue.assigned_to) : "-" %></td>
+ <th class="assigned-to"><%=l(:field_assigned_to)%>:</th><td class="assigned-to">