Skip to content

Instantly share code, notes, and snippets.

View treyharris's full-sized avatar

Trey Harris treyharris

View GitHub Profile
% file=irc.freenode.\#perl6.weechatlog
% grep auto-new $file
2017-04-11 15:58:14 jnthn m: multi trait_mod:<is>(Method:D $m, :$auto-new!) { $m.wrap: -> \obj, |c { callwith(obj.DEFINITE ?? obj !! obj.new, |c) } }; class C { has
$.x = 0; method m() is auto-new { say $!x } }; C.m; C.new.m
2017-04-11 15:59:09 jnthn So you only have to put "is auto-new" on the class, not on each method
2017-04-11 15:59:59 jnthn m: multi trait_mod:<is>(Method:D $m, :$auto-new!) { $m.wrap: -> \obj, |c { callwith(obj.DEFINITE ?? obj !! obj.new, |c) } }; class C { has
$.x = 0; method m() is auto-new { say $!x } }; C.m; C.new(x => 42).m # just checking :)
2017-04-11 16:00:07 TreyHarris but with that I'd write: use Whatever:from<Perl5>; class P6::Whatever is Whatever { method fields is auto-new { nextsame; } }
Binary file irc.freenode.#perl6.weechatlog matches
% pcregrep auto-new $file
% mi6 help
===SORRY!=== Error while compiling /home/trey/.rakudobrew/moar-nom/install/share/perl6/site/resources/19DFC05B99EC4E218A1A8D9A1B966919724DE593
Two terms in a row
at /home/trey/.rakudobrew/moar-nom/install/share/perl6/site/resources/19DFC05B99EC4E218A1A8D9A1B966919724DE593:1
------> @ perl6 %~dpn0 %*
expecting any of:
infix
infix stopper
statement end
statement modifier
#!/usr/bin/env perl6
use v6.c;
class Example {
has $.x is rw = 0;
method double-x is rw {
return-rw Proxy.new(
:FETCH{ $!x * 2 },
:STORE(-> $, $dubX { $!x = $dubX / 2 }),
#!/usr/bin/env perl6
# From Language/container.pod6:
sub lucky(::T $type) {
my T $c-value; # closure variable
return Proxy.new(
FETCH => method () { $c-value },
STORE => method (T $new-value) {
X::OutOfRange.new(what => 'number', got => '13', range => '-∞..12, 14..∞').throw
if $new-value == 13;
$ cargo install ripgrep
Updating registry `https://github.com/rust-lang/crates.io-index`
Downloading ripgrep v0.5.2
Downloading winapi-build v0.1.1
Downloading fs2 v0.4.1
failed to compile `ripgrep v0.5.2`, intermediate artifacts can be found at `/home/trey/src/ripgrep/target-install`
Caused by:
unable to get packages from source
@treyharris
treyharris / PowerShell.out
Created July 24, 2017 16:40
Remove-Item error
PS C:\Program Files (x86)\Steam\steamapps\common\SteamVR\content> Remove-Item -Path 'C:\Program Files (x86)\Steam\steamapps\common\SteamVR\content\panorama\window_keybinds.cfg\' -Force
Remove-Item : Access is denied
At line:1 char:1
+ Remove-Item -Path 'C:\Program Files (x86)\Steam\steamapps\common\Stea ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (C:\Program File...w_keybinds.cfg\:String) [Remove-Item], UnauthorizedAccessException
+ FullyQualifiedErrorId : ItemExistsUnauthorizedAccessError,Microsoft.PowerShell.Commands.RemoveItemCommand
Remove-Item : Cannot find path 'C:\Program Files (x86)\Steam\steamapps\common\SteamVR\content\panorama\window_keybinds.cfg\' because it does not exist.
At line:1 char:1
{
"$schema": "https://coriolis.edcd.io/schemas/ship-loadout/4.json#",
"name": "Hafte Sorvalh - Python",
"ship": "Python",
"references": [
{
"name": "Coriolis.io",
"url": "https://coriolis.edcd.io/outfit/python?code=A0pitfFflidsssf57l0t0t2f18----05054i0404032iC82f.Iw18eQ%3D%3D.IwBhrSusGYBZYCZhA%3D%3D%3D.H4sIAAAAAAAAAz2Muw3CQBBExzY%2FIYuTDoNPREgQX0IblIAIqIMKKIBKKIEMQmpwiiMHfHaYS9hkR%2FP2beaPGTB%2FFIC7K43OAJhb0PqqxGzdA8KlD%2Fidka7tyGqptMqfJAtbpEthuO2L9HECVJupnKtEDuyQuD7DN1Ld%2BE2GUn60j%2Fza9n9%2BGgLxVsoi0vwAxw1Gp5wAAAA%3D&bn=Hafte%20Sorvalh%20-%20Python",
"code": "A0pitfFflidsssf57l0t0t2f18----05054i0404032iC82f.Iw18eQ==.IwBhrSusGYBZYCZhA===.H4sIAAAAAAAAAz2Muw3CQBBExzY/IYuTDoNPREgQX0IblIAIqIMKKIBKKIEMQmpwiiMHfHaYS9hkR/P2beaPGTB/FIC7K43OAJhb0PqqxGzdA8KlD/idka7tyGqptMqfJAtbpEthuO2L9HECVJupnKtEDuyQuD7DN1Ld+E2GUn60j/za9n9+GgLxVsoi0vwAxw1Gp5wAAAA=",
"shipId": "python"
# -*-shell-script-*-
# Prompt user for info but don't accept the empty string
#
# TODO 2015-02-12: generalize; make a version that will
# accept empty, will loop until it gets non-empty, etc.
function promptNonNull () {
# args:
# prompt (string) User prompt. Append a trailing space if desired.
# variable (varname) Name of variable in which to store response.
local answer="${(P)2}"
#!/bin/bash
dir=$PWD
until [ -e "$dir/.git" ]; do
if [ "$dir" == "/" ]; then
echo "This isn't a git working dir" >&2
exit 1;
fi
dir=`dirname "$dir"`
done
#!/bin/zsh
#
# A git hook to make sure user.email exists before committing
# Used to be you could give a user.email of "(none)" and that would
# cause failure to commit, but that's gone now. :-(
#
# Instead, it assumes the following aliases in .gitconfig:
# email-public = "!f() { git config user.email $(git config
# --get user.publicemail); git config --get user.email; }; f"
# email-work = "!f() { git config user.email $(git config