Skip to content

Instantly share code, notes, and snippets.

package Hackmachine::Resource;
use strict;
use warnings;
use Data::Dumper;
use parent 'Web::Machine::Resource';
our @data = qw( hello hi hey howdy );
package Hackmachine::Resource;
use strict;
use warnings;
use Data::Dumper;
use parent 'Web::Machine::Resource';
our @data = qw( hello hi hey howdy );
package Hackmachine::Resource;
use strict;
use warnings;
use parent 'Web::HyperMachine::Resource';
__PACKAGE__->uri('hack');
__PACKAGE__->related('Hackmachine::OtherResource');
@Altreus
Altreus / gist:9074843
Created February 18, 2014 16:54
force one page of output
1p() {
echo -en "\033[?7l"
"$@" | head -$(expr $(tput lines) - 2)
echo -e "\033[?7h"
}
$ http localhost:5000/trope Accept:application/json
HTTP/1.0 200 OK
Content-Length: 130
Content-Type: application/json
Date: Wed, 19 Feb 2014 14:11:31 GMT
Server: HTTP::Server::PSGI
Vary: Accept
{
"items": [
fs.readdir(dir, function(err, files){
for(x in files){
let fn = files[x];
if (! fn.match(/\.html$/)) {
continue;
}
fs.readFile(
dir + '/' + fn,
use 5.010;
use strict;
my $i = 0;
my %fb = qw (3 fizz 5 buzz 7 wolf);
my %h = map { (2 ** $i++), $_ } qw (fizz buzz wolf);
for my $x (1..105) {
my $num = 0;
return (isNaN(ai) || isNaN(bi)) ?
(a > b) ? 1
: (a < b) ? -1
: 0 // not floats
: (ai > bi) ? 1
: (ai < bi) ? -1
: 0;
@Altreus
Altreus / gist:9e02fe7bb9c2b7aa5d57
Created May 15, 2014 11:50
git knows when you're timing it
$ time git stash pop
On branch user-page
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: fuel/app/modules/management/views/user/list.php
Untracked files:
(use "git add <file>..." to include in what will be committed)
Rebase example!
===============
I forgot to commit some things remotely before I cloned my repo to work locally.
altreus@local:~ $ git clone altre.us:altre.us
Cloning into altre.us ...
<snip>
altreus@local:~/altre.us $ do_stuff
altreus@local:~/altre.us $ git commit -a -m"Turn off static cache for now"