This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| set src to choose folder | |
| set target_files to getFiles(src) | |
| tell application "iTunes" | |
| repeat with f in target_files | |
| try | |
| add f | |
| delay 1 | |
| on error | |
| log f | |
| end try |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| on run | |
| sum({1, 2, 3, {1, 2}}) | |
| end run | |
| on sum(arg) | |
| -- 数値リストの総和を求める | |
| -- リストが含まれている場合は再帰的に中身も合計する | |
| if arg is equal to {} then | |
| set result to 0 | |
| else if class of arg's first item is equal to list then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use v6; | |
| sub MAIN ($n! is copy, $radix = "2**31") { | |
| my $num_radix = eval $radix.Str; | |
| my $num_n = eval $n.Str; | |
| CATCH { | |
| die "something is wrong!"; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class User { | |
| has Int $.count is rw; | |
| has Int $.time is rw; | |
| has DateTime $.lastlogin is rw; | |
| method new () { | |
| return self.bless(*, count => 1, time => 0); | |
| } | |
| } | |
| role Minecraft::ServerLog::Actions { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use v6; | |
| my @count = 0 xx 10; | |
| my @tmp; | |
| my $i; | |
| for 0..1023 -> $n { | |
| $i = 0; | |
| @tmp = $n.fmt("%010b").comb; | |
| for @tmp { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Error log says that | |
| --- | |
| % ./Configure.pl --gen-parrot | |
| Bareword found where operator expected at lib/lib.pm line 3, near "@*INC" | |
| (Missing operator before INC?) | |
| Operator or semicolon missing before *INC at lib/lib.pm line 3. | |
| Ambiguous use of * resolved as operator * at lib/lib.pm line 3. | |
| syntax error at lib/lib.pm line 3, near "@*INC" | |
| Compilation failed in require at ./Configure.pl line 10. | |
| BEGIN failed--compilation aborted at ./Configure.pl line 10. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use v6; | |
| grammar XML { | |
| token word { \w+ } | |
| token element { [ $<characters>=(<.word>+ % <.ws>) || <tag>] } | |
| token attr { $<attr_name>=<word> '=' '"' $<attr_val>=<word> '"' } | |
| token tag { | |
| '<' $<tag_name>=<word> <.ws> [<attr>+ % <.ws>]? '>' <.ws> | |
| [<element>* % <.ws>] <.ws> | |
| '</' <{$<tag_name>}> '>' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use 5.14.0; | |
| use List::Util qw/sum/; | |
| use Tie::IxHash; | |
| use Data::Dumper; | |
| use POSIX; | |
| my @params_a = ("STR", "CON", "POW", "DEX", "APP"); | |
| my @params_b = ("SIZ", "INT"); | |
| my %all; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <sox.h> | |
| #include "ruby.h" | |
| #include <stdlib.h> | |
| #include <assert.h> | |
| typedef struct sox_target { | |
| sox_format_t * in; | |
| sox_format_t * out; | |
| sox_effects_chain_t * chain; | |
| } sox_target_t; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #原文 (http://perldoc.jp/func/quotemeta) | |
| EXPR の中のすべての非英数字キャラクタをバックスラッシュで エスケープしたものを返します (つまり、/[A-Za-z_0-9]/ にマッチしない全ての文字の前には ロケールに関わらずバックスラッシュが前置されます)。 これは、ダブルクォート文字列での \Q エスケープを 実装するための内部関数です。 | |
| EXPR が省略されると、$_ を使います。 | |
| クォートメタ (と \Q ... \E) は、文字列を正規表現に展開するのに 便利です; なぜなら、デフォルトでは展開された変数は小さな正規表現として 扱われるからです。 例えば: | |
| my $sentence = 'The quick brown fox jumped over the lazy dog'; | |
| my $substring = 'quick.*?fox'; | |
| $sentence =~ s{$substring}{big bad wolf}; |