Skip to content

Instantly share code, notes, and snippets.

@Phrogz
Phrogz / html5.haml
Last active August 29, 2015 13:56 — forked from fnhipster/html5.haml
!!! 5
%html
%head
%meta(charset="utf-8")
%title Page Title
%meta(name="author" content="")
%meta(name="description" content="")
%meta(name="revisit-after" content="3 days")
%link(href="http://creativecommons.org/licenses/by/4.0/" rel="license" title="Creative Commons Attribution License")
%link(href="/css/screen.css" media="screen" rel="stylesheet")
-------+-------------------------------------------------------------------------------
-- ct | code -------------------------------------------------------------------------
-------+-------------------------------------------------------------------------------
120 local LXSC = require 'lib/lxsc';
*****0 (function(S)
120 S.MAX_ITERATIONS = 1000
120 local OrderedSet,Queue,List = LXSC.OrderedSet, LXSC.Queue, LXSC.List
-- ****************************************************************************
-- $ ./autotest.lua test579.scxml
enterStates( enabledTransitions:{ <transition target='s0' external> } )
computeEntrySet( transitions:{ <transition target='s0' external> }, ... )
addDescendantStatesToEnter( state:<state id=s0>, ... )
statesToEnter:add( <state id=s0> )
getEffectiveTargetStates( transition:<transition target='sh1' external> )
getEffectiveTargetStates( transition:<transition target='s01' external> )
-- getEffectiveTargetStates result: { <state id=s01> }
-- getEffectiveTargetStates result: { <state id=s01> }
addDescendantStatesToEnter( state:<state id=s01>, ... )
USAGE = <<ENDUSAGE
Usage:
docubot [-h] [-v] [create [-s shell] [-f]] directory [-w writer] [-o output_file] [-n] [-l log_file]
ENDUSAGE
HELP = <<ENDHELP
-h, --help Show this help.
-v, --version Show the version number (#{DocuBot::VERSION}).
create Create a starter directory filled with example files;
also copies the template for easy modification, if desired.
peers = {
node1: :node2,
node2: :node1,
node3: :node4,
node4: :node3
}
describe 'peers' do
peers.each do |a,b|
it "should have #{b} as a peer", if: Socket.gethostname=="#{a}.vagrantup.com" do
@Phrogz
Phrogz / lib slash bar.rb
Created September 10, 2014 17:51
Spiderweb of requires
puts :bar1
require_relative '../lib'
puts :bar2
@Phrogz
Phrogz / gist:c0e33e9b7c8cc23f56aa
Last active August 29, 2015 14:06
Merging class attributes up the tree
class Ancestor
@props = {a:1, b:1, c:1}
def self.merged
(ancestors[1].respond_to?(:merged) ? ancestors[1].merged : {}).merge(@props)
end
end
class Child < Ancestor
@props = {a:2}
end
Rammy:RUIC phrogz$ gem help build
Usage: gem build GEMSPEC_FILE [options]
[...]
Common Options:
[...]
-q, --quiet Silence commands
[...]
Rammy:RUIC phrogz$ gem build ruic.gemspec -q
Successfully built RubyGem
@Phrogz
Phrogz / background.txt
Last active August 29, 2015 14:06
DSL Options
A wrapper contains "elements" (think of an XML element).
A wrapper has "slides" (variations on the elements within it).
An element might exist on every slide of the wrapper (on the 'master slide'),
or it might exist only on one of the slides.
An element has attributes.
* When an element exists only on a particular slide, the attributes also exist
only on that slide. There is only one value for each attribute.
# Returns a hash mapping image paths to arrays of the assets referencing them
def image_usage
{}.tap do |usage|
asset_types = app.metadata.by_name.values + @class_by_ref.values
image_properties_by_type = asset_types.flat_map do |type|
type.properties.values
.select{ |property| property.type=='Image' || property.type == 'Texture' }
.map{ |property| [type,property] }
end.group_by(&:first).tap{ |x| x.each{ |t,a| a.map!(&:last) } }