Skip to content

Instantly share code, notes, and snippets.

{
"purescript.codegenTargets": [ "corefn" ],
"purescript.addSpagoSources": true,
"purescript.buildCommand": "spago build --purs-args --json-errors"
}
@nwolverson
nwolverson / json.log
Created July 23, 2018 21:16
json trace
This file has been truncated, but you can view the full file.
Debugger listening on port 11128.
Warning: This is an experimental feature and could change at any time.
To start debugging, open the following URL in Chrome:
chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:11128/762898b5-b49b-4cbd-818c-1f70111ce54e
[Trace - 21:53:30] Sending notification '$/setTraceNotification'.
Params: {
"value": "verbose"
}
This file has been truncated, but you can view the full file.
Debugger listening on port 11128.
Warning: This is an experimental feature and could change at any time.
To start debugging, open the following URL in Chrome:
chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:11128/762898b5-b49b-4cbd-818c-1f70111ce54e
[Trace - 21:53:30] Sending notification '$/setTraceNotification'.
Params: {
"value": "verbose"
}
module DataTypes where
data Foo = Foo
mkFoo = Foo
data Bar = Bar
data Baz = Baz1 | Baz2
#!/bin/bash
# TODO: Get current git tag
VER=${1:-"1.0.0"}
psc-package dependencies | perl -pe 's/^(.*)$/"\1"/g' | jq -s . > deps.json
jq < psc-package.json --slurpfile bower bower.json --slurpfile deps deps.json --arg version "$VER" --arg deps "$DEPS" \
'{(.name): { dependencies: ($deps | .[0]), repo: ($bower | .[0].repository.url | gsub("git:";"https:") ), version: $version } }'
@nwolverson
nwolverson / package-from-bower.sh
Created March 9, 2017 21:07
create psc-package.json from bower.json
#!/bin/bash
SET=${1:-"erl-0.10.5"}
SOURCE=${2:-"https://github.com/purerl/package-sets.git"}
if [ ! -f "psc-package.json" ]; then
jq < bower.json "{name, set: \"$SET\", source: \"$SOURCE\", depends: [] }" > psc-package.json
fi
jq < bower.json '.dependencies | keys | map(gsub("purescript-";"")) | join("\n")' -r | while read -r line ; do
psc-package install $line;

Normally the plugin starts psc-ide-server automatically, and writes the server port to a file. It may help to run psc-ide-server manually with debug flag to diagnose issues, as follows.

(In purescript project, ie the place where bower.json lives)

echo -n 1234 > .psc-ide-port
psc-ide-server -p 1234 --debug
var BarChart1 = React.createClass({
render: function() {
var x = scale.linear()
.domain([0, _.max(this.props.data)])
.range([0, 420]);
return (
<div className="chart">
{
this.props.data.map(function (n) {
function Get-VisualChildren($item) {
for ($i = 0; $i -lt [System.Windows.Media.VisualTreeHelper]::GetChildrenCount($item); $i++) {
$child = [System.Windows.Media.VisualTreeHelper]::GetChild($item, $i)
Get-VisualChildren($child)
}
$item
}
function Get-TreeItems {
Get-VisualChildren $snoopui | ? { $_.GetType().Name -eq "ProperTreeViewItem" }
@nwolverson
nwolverson / Charting.fs
Created June 14, 2013 15:21
Examples of using Visiblox Charts with F#, with a simple wrapper.
namespace Visiblox.FSharp.Charting
open Visiblox.Charts
open System.Collections.Generic
module Data =
let private ds (x: DataPoint<_,_> seq) = new DataSeries<_,_>(x)
let Point (x,y) = new DataPoint<_,_>(x,y)
let MultiValuePoint x ys = new MultiValuedDataPoint<_,_>(x, new Dictionary<_,_>(dict ys))