Skip to content

Instantly share code, notes, and snippets.

resources :a do
resources :b do
resources c
end
end
resources :d do
resources :c
end
resources :a do
resources :b do
resources :c
end
end
Controller c
before_action :set_parents
...
def set_parents
(use-modules (ice-9 format))
(use-modules (srfi srfi-19))
(define utc (current-date 0))
(define sast (current-date))
(format #t "utc ~a\n" utc)
(format #t "sast ~a\n" sast)
(define utc-jdn (date->modified-julian-day utc))
Bash example:
-------------
$ read -e -p '> ' -i 'default' a
> default
$ echo $a
default
guile example:
--------------
scheme@(guile-user)> (use-modules (ice-9 readline))
# Class definition of ChannelImageButton
class ChannelImageButton( ButtonBehavior, Image ):
pass
# Code that is adding the ChannelImageButtons to the GridLayout in the ScrollView.
# Get a list of images
channels = project.get_image_channels( btn.__image_id__ )
#:kivy 1.9
# In Kivy language, the widget added last is at the top of the window in terms of Z.
# So to make sure that buttons receive the click event, add them last so they are not
# overridden by the other widgets.
<StartScreen>:
entire_window: entire_window
nav_bar: nav_bar
action_group: action_group
BoxLayout:
size: root.size
pos: root.pos
orientation: "vertical"
FileChooserIconView:
id: filechooser
rootpath: os.path.expanduser('~') + "/UCPA"
filters: [ "*.scanit" ]
on_submit: root.double_clicked( )
Traceback (most recent call last):
File "main.py", line 29, in <module>
from kivy.garden.resizable_behavior import ResizableBehavior
File "/usr/local/lib/python3.6/site-packages/kivy/garden/__init__.py", line 100, in load_module
return self._load_module(fullname, moddir)
File "/usr/local/lib/python3.6/site-packages/kivy/garden/__init__.py", line 104, in _load_module
('', '', imp.PKG_DIRECTORY))
File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/imp.py", line 244, in load_module
return load_package(name, filename)
File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/imp.py", line 216, in load_package
ChangeState( Kd = ( 0.0, 1.0, 0.0 ),
Ka = ( 1.0, 1.0, 0.0 ),
Ks = ( .3, .3, .3 ),
Tr = 1.,
Ns = 1.,
intensity = 0.8 )
Mesh( vertices = self.borehole_vertices.flatten( ),
indices = self.borehole_indices,
fmt = self.vertex_format,
@onslauth
onslauth / mesh.py
Last active September 9, 2017 16:56
# Draw the North, East, South, West labels
label = CoreLabel( text = "North", font_size = '20sp', bold = True, color = ( 1, 1, 1, 1 ) )
label.refresh( )
texture = label.texture
Mesh( vertices = ( 0, 0, 0, 0, 1, 1, 1, 0, 1,
2, 0, 0, 0, 1, 1, 1, 1, 1,
2, 2, 0, 0, 1, 1, 1, 1, 0,
0, 2, 0, 0, 1, 1, 1, 0, 0 ),
indices = [ 0, 1, 2, 0, 2, 3 ],