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
var http = require('http'); | |
var handler = function(req, res) { | |
res.write('Hello Node'); | |
res.end(); | |
}; | |
var server = http.createServer( handler ); | |
server.listen(8080 ); |
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 strict; | |
use warnings; | |
use v5.14; | |
my $RE_PATTERN = qr { | |
# | |
# This is a cool regular pattern | |
# | |
# DIGIT DIIGT DIGIT Ends with an x | |
[0-9] [0-9] [0-9] x$ |
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
# Program 1 -- print the third column of each line | |
perl -pe '$_ =perl -ane 'print $F[2], "\n"' | |
# Program 2 -- treat each line as a number and sum all lines | |
perl -pe '$\+=$_}{' | |
# Program 3 -- print an empty line after each line | |
perl -pe '$\="\n"' | |
# Program 4 -- number the lines |
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 strict; | |
use warnings; | |
use v5.14; | |
package Promise::Common; | |
use Moose::Role; | |
has 'ctx', is => 'ro', required => 1; | |
requires 'state'; |
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
package bp.logic; | |
class BPResult { | |
int bulls; | |
int cows; | |
bool is_winner() { ... } | |
BPResult( int bulls, int cows) {} | |
} |
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 strict; | |
use warnings; | |
use v5.14; | |
package My::Script::Params; | |
use Moose; | |
with 'MooseX::Getopt'; | |
has 'app_pkg', is => 'rw', required => 1, isa => 'Str'; | |
has 'model', is => 'rw', isa => 'Str'; |
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 strict; | |
use warnings; | |
use v5.14; | |
use List::Util qw/sum/; | |
use Data::Dumper; | |
sub diff_sum { | |
my ( $l_ref, $g_ref ) = @_; | |
return sum(@$l_ref) - sum(@$g_ref); | |
} |
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
#nav { | |
list-style: none; | |
padding: 0; margin: 0; | |
display: none; | |
} | |
li { | |
display: inline-block; | |
padding: 10px; | |
background: #777; |
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
.autocomplete { | |
list-style: none; | |
position: absolute; | |
top: 0; | |
left: 0; | |
padding: 0; | |
margin: 0; | |
outline: 1px solid gray; | |
display: none; | |
} |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Image Gallery</title> | |
<style> | |
#gallery { | |
list-style: none; | |
} | |
#gallery img { | |
width: 200px; |