Skip to content

Instantly share code, notes, and snippets.

@ryanartecona
ryanartecona / confirm
Created December 14, 2012 06:44
Add a sanity confirmation to sensitive commands
# with help from
# http://stackoverflow.com/questions/3231804/in-bash-how-to-add-are-you-sure-y-n-to-any-command-or-alias
# and
# http://stackoverflow.com/questions/1537673/how-do-i-forward-parameters-to-other-command-in-bash-script
function confirm( ) {
#confirm with the user
read -r -p "$* [y/n]: " response
case "$response" in
[yY][eE][sS]|[yY])
@ryanartecona
ryanartecona / journalctl.log
Created January 28, 2016 13:48
nixos in virtualbox device errors
-- Logs begin at Thu 2016-01-28 13:33:09 UTC, end at Thu 2016-01-28 13:45:00 UTC. --
Jan 28 13:33:09 nixos systemd-journal[346]: Runtime journal is using 4.0M (max allowed 24.9M, trying to leave 37.4M free of 244.7M available → current limit 24.9M).
Jan 28 13:33:09 nixos systemd-journal[346]: Permanent journal is using 8.0M (max allowed 995.0M, trying to leave 1.4G free of 8.2G available → current limit 995.0M).
Jan 28 13:33:09 nixos systemd-journal[346]: Time spent on flushing to /var is 461us for 2 entries.
Jan 28 13:33:09 nixos kernel: Initializing cgroup subsys cpuset
Jan 28 13:33:09 nixos kernel: Initializing cgroup subsys cpu
Jan 28 13:33:09 nixos kernel: Initializing cgroup subsys cpuacct
Jan 28 13:33:09 nixos kernel: Linux version 3.18.21 (nixbld@localhost) (gcc version 4.9.3 (GCC) ) #1-NixOS SMP Thu Jan 1 00:00:01 UTC 1970
Jan 28 13:33:09 nixos kernel: Command line: BOOT_IMAGE=(hd0,msdos1)/nix/store/vvabsbnxmh8nx6pq0bkk6vpsy5cqf9i5-linux-3.18.21/bzImage systemConfig=/nix/store/8wxgz4j6f5

Integrating PureScript into a Legacy JS Codebase

Tooling (w/ Electron)

  • compiled & used in an electron app
  • purescript is pulled in as an npm dep, and electron-compile has a step to compile PS to JS & move files to where they need to be.

Calling interop

For PS -> JS

Keybase proof

I hereby claim:

  • I am ryanartecona on github.
  • I am ryanartecona (https://keybase.io/ryanartecona) on keybase.
  • I have a public key ASCkIymkiDMCmn5vKJngoAPnK2h5GUunuwWGIOEd52LahAo

To claim this, I am signing this object:

> result/embedded/bin/ruby --debug result/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/pre-rubygems.rb --help
Exception `LoadError' at /nix/store/1wmp1mbsxwlkyipjmyvw1lzca7wz4fhv-ruby-2.2.5/lib/ruby/site_ruby/2.2.0/rubygems.rb:1344 - cannot load such file -- rubygems/defaults/operating_system
Exception `LoadError' at /nix/store/1wmp1mbsxwlkyipjmyvw1lzca7wz4fhv-ruby-2.2.5/lib/ruby/site_ruby/2.2.0/rubygems.rb:1353 - cannot load such file -- rubygems/defaults/ruby
Exception `LoadError' at /nix/store/1wmp1mbsxwlkyipjmyvw1lzca7wz4fhv-ruby-2.2.5/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55 - cannot load such file -- bundler
Ignoring binding_of_caller-0.7.2 because its extensions are not built. Try: gem pristine binding_of_caller --version 0.7.2
Exception `LoadError' at /nix/store/1wmp1mbsxwlkyipjmyvw1lzca7wz4fhv-ruby-2.2.5/lib/ruby/2.2.0/resolv.rb:168 - LoadError
Using Ext extension for JSON.
/nix/store/hpyq4ir3gx8krr6pnmdxjnd293w2fvxk-vagrant-1.8.6/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/b
> sudo dtruss -f -t open result/embedded/bin/ruby result/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/pre-rubygems.rb --help
/nix/store/1wmp1mbsxwlkyipjmyvw1lzca7wz4fhv-ruby-2.2.5/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- bundler (LoadError)
from /nix/store/1wmp1mbsxwlkyipjmyvw1lzca7wz4fhv-ruby-2.2.5/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /nix/store/hpyq4ir3gx8krr6pnmdxjnd293w2fvxk-vagrant-1.8.6/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/bundler.rb:7:in `<top (required)>'
from result/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/pre-rubygems.rb:19:in `require_relative'
from result/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/pre-rubygems.rb:19:in `<main>'
dtrace: 5825 dynamic variable drops with non-empty dirty list
PID/THRD SYSCALL(args) = return
65881/0x46dc08: open(".\0", 0x0, 0x1) = 3 0
general:
build_dir: cli
machine:
environment:
NIX_PROFILE: /nix/var/nix/profiles/ubuntu
PATH: $NIX_PROFILE/bin:$PATH
NIX_PATH: nixpkgs=/nix/var/nix/profiles/per-user/ubuntu/channels/nixpkgs
dependencies:

Purescript Halogen: Past, Present, and Future

Talk by John De Goes

Halogen is a Purescript UI framework in the spirit of React (but doesn’t wrap React) with the goal of expressing UIs in a declarative and type-safe way.

FRP & React

FRP (in typed languages) typically needs “reactive” data types to be parameterized over the type of the things they “produce” so the FRP machinery can control how values of that type get passed around. In the more React-y style, events are supported somehow internally by the main UI data type (so don’t need to be parameterized in that way).