sync database from source alias to the target alias drush sql-sync @prod @dev (copies the production db to dev for testing purposes.)
rsync files from the drupal root of @source to the drupal root of @target alias
<?php | |
/** | |
* Removes user as owner if they are currently owner. | |
*/ | |
function bglib_remove_owner($nid, $uid) { | |
$u = user_load($uid); | |
$wrapper = entity_metadata_wrapper('node', $nid); | |
$owners = $wrapper->field_owners->value(); | |
foreach($owners as $delta => $owner) { |
(def route (slurp "./houses.txt")) | |
(def visits (set [])) | |
;; (conj " | |
;; (def current {:x 0, :y 0}) | |
;; Add 1 to x | |
;; (def current (assoc current :x (+ 1 (get current :x)))) | |
(defn inc-x [] | |
(def current (assoc current :x (inc (get current :x))))) | |
(defn inc-y [] | |
(def current (assoc current :y (inc (get current :y))))) |
class SantaMap | |
attr_accessor :visits, :cur_x, :cur_y | |
def initialize | |
@visits = Hash.new(0) | |
@cur_x = 0 | |
@cur_y = 0 | |
end | |
def move(direction) |
(use 'clojure.java.io) | |
(def ribbon (atom 0)) | |
(def paper (atom 0)) | |
(with-open [rdr (reader "./presents.txt")] | |
(doseq [line (line-seq rdr)] | |
(let [all (clojure.string/split line #"x") | |
w (. Integer parseInt (first all)) | |
h (. Integer parseInt (second all)) |
boxes =<<HERE | |
20x3x11 15x27x5 6x29x7 30x15x9 19x29x21 10x4x15 1x26x4 1x5x18 10x15x23 10x14x20 3x5x18 29x23x30 7x4x10 22x24x29 30x1x2 19x2x5 11x9x22 23x15x10 11x11x10 30x28x5 22x5x4 6x26x20 16x12x30 10x20x5 25x14x24 16x17x22 11x28x26 1x11x10 1x24x15 13x17x21 30x3x13 20x25x17 22x12x5 22x20x24 9x2x14 6x18x8 27x28x24 11x17x1 1x4x12 5x20x13 24x23x23 22x1x25 18x19x5 5x23x13 8x16x4 20x21x9 1x7x11 8x30x17 3x30x9 6x16x18 22x25x27 9x20x26 16x21x23 5x24x17 15x17x15 26x15x10 22x16x3 20x24x24 8x18x10 23x19x16 1x21x24 23x23x9 14x20x6 25x5x5 16x3x1 29x29x20 11x4x26 10x23x24 29x25x16 27x27x22 9x7x22 6x21x18 25x11x19 14x13x3 15x28x17 14x3x12 29x8x19 30x14x20 20x23x4 8x16x5 4x11x18 20x8x24 21x13x21 14x26x29 27x4x17 27x4x25 5x28x6 23x24x11 29x22x5 30x20x6 23x2x10 11x4x7 27x23x6 10x20x19 8x20x22 5x29x22 16x13x2 2x11x14 6x12x4 3x13x6 16x5x18 25x3x28 21x1x5 20x16x19 28x30x27 26x7x18 25x27x24 11x19x7 21x19x17 2x12x27 20x5x14 8x5x8 6x24x8 7x28x20 3x20x28 5x20x30 13x29x1 26x29x5 19x28x25 5x19x11 11x20x22 4x23x1 19x25x12 3x10x6 3x14x |
basement = [] | |
floor = 0 | |
f = File.read("./santas_map_input.txt") | |
f.chars.each_with_index do |f, idx| | |
if f=='(' | |
floor += 1 | |
else | |
floor -= 1 | |
end |
require 'nori' | |
def parse_file(file) | |
f = File.read(file) | |
parser = Nori.new(:convert_tags_to => lambda { |tag| tag.snakecase.to_sym }, :strip_namespaces => true) | |
parser.parse(f) | |
end | |
x = parse_file("./newvap_oc.xml") |