This file contains 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
package sample; | |
import org.apache.log4j.Logger; | |
public class Sample | |
{ | |
public static void main(String[] args) | |
{ | |
final Logger log = Logger.getLogger("access"); | |
log.debug("Test"); |
This file contains 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
#!/usr/bin/env perl | |
use 5.12.0; | |
use warnings; | |
# It sprits a character string in N characters. | |
my @alphabets = join('', 'a' .. 'y') =~ m/.{1,3}/g; | |
say join ',', @alphabets; | |
# >> abc,def,ghi,jkl,mno,pqr,stu,vwx,y |
This file contains 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
#!/usr/bin/env perl | |
use 5.12.0; | |
use warnings; | |
use List::Util qw/shuffle/; | |
use constant { | |
P => 'Player', | |
D => 'Dealer', | |
}; |
This file contains 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
# Concatenate elisp files in the current directory | |
for f in $(ls | grep -E 'el$'); do $(cat $f >> concat.el); $(echo -e "\n" >> concat.el); done |
This file contains 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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use feature qw(say); | |
use constant LENGTH => 10; | |
my ($n, $min, $max) = (shift @ARGV || 8, 0, 0); | |
my @positions = (); | |
push @positions, int(rand(LENGTH + 1)) for (1 .. $n); | |
for my $position (@positions) { |
This file contains 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
find . -name "*.php" -exec rm -v {} \; | tee /dev/tty | wc -l |
This file contains 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
/* | |
平山尚『ゲームプログラマになる前に覚えておきたい技術』より | |
お題:荷物運びゲームを2時間以内につくる | |
*/ | |
#include<iostream> | |
using namespace std; | |
char screen[5][8] = { |
This file contains 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
var obj = (function() { | |
var _canvas = 'canvas'; | |
function _radian(x) { | |
return x * Math.PI / 180; | |
} | |
// public api | |
return { | |
canvas: _canvas, | |
radian: _radian |
This file contains 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
// using static methods | |
console.log(Date.now()); // 1357662789317 | |
// if you have Date objects | |
console.log(new Date().getTime()); // 1357662789317 | |
// numeric context | |
console.log(+new Date); // 1357662789317 | |
console.log(+new Date()); // 1357662789317 |
This file contains 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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use feature qw(say); | |
my @lines; | |
while (<>) { | |
chomp; | |
next unless $_; | |
push @lines, $_; |
OlderNewer