Skip to content

Instantly share code, notes, and snippets.

View kfly8's full-sized avatar
🐪
Working from home

kobaken kfly8

🐪
Working from home
View GitHub Profile
use strict;
use warnings;
use feature 'say';
say join ':', split '', 'abc';
#!/usr/bin/env perl
use 5.10.0;
use strict;
use warnings;
use Test::More;
sub hoge {
my %ret;
for my $row (@_) {
#!/usr/bin/env perl
use 5.10.0;
use strict;
use warnings;
use Test::More;
sub hoge { join ',', ('?') x @_ }
is hoge(qw/1 3 4 5/), '?,?,?,?';
@kfly8
kfly8 / heroku-ruby-hello-world.md
Last active August 29, 2015 13:59
もばこんの下準備するよー #もばこん
@kfly8
kfly8 / REAME.md
Last active August 29, 2015 14:03
yapc asia 2014 の応募トークの断片
@kfly8
kfly8 / gist:ca126161ecf35d697f06
Created July 24, 2014 15:23
0 に評価されるのが複数あると、無限ループのよう
use List::UtilsBy qw/weighted_shuffle_by/;
my @wlist = (
{ value => 'a', weight => 0 },
{ value => 'b', weight => 0 },
);
weighted_shuffle_by { $_->{weight} } @wlist;
@kfly8
kfly8 / infite_loop.pl
Last active August 29, 2015 14:04
weighted_shuffle_list
use List::UtilsBy qw/weighted_shuffle_by/;
my @wlist = (
{ value => 'a', weight => 0 },
{ value => 'b', weight => 0 },
);
weighted_shuffle_by { $_->{weight} } @wlist;
@kfly8
kfly8 / bulk_check.html
Created August 21, 2014 11:16
angular sample
<!doctype html>
<html ng-app='sample'>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.22/angular.min.js"></script>
<script>
angular.module('sample', [])
.controller('MainCtrl', ['$scope', function($scope) {
$scope.bulk_check = function() {
angular.forEach($scope.items, function(item) {
CREATE TABLE user_event_ranking (
event_id INTEGER,
user_id INTEGER,
score INTEGER,
PRIMARY KEY (event_id, user_id),
INDEX KEY (event_id, score)
);
CREATE TABLE user_event_ranking (