Skip to content

Instantly share code, notes, and snippets.

View deadcheat's full-sized avatar
⛱️
deadcheat is #allelite now

deadcheat deadcheat

⛱️
deadcheat is #allelite now
  • Tokyo
View GitHub Profile
@deadcheat
deadcheat / main.rs
Created July 22, 2019 12:44
rust で CLI Parser とスレッドがうまく行かなかったやつ解決した。すごい
extern crate reqwest;
use structopt::StructOpt;
use std::thread;
use std::sync::mpsc;
use std::sync::Arc;
#[derive(StructOpt, Debug, Clone)]
#[structopt()]
struct Opt {
@deadcheat
deadcheat / main.go
Created October 31, 2018 17:20
自分用ESのIdsクエリ
package main
import (
"context"
"fmt"
"github.com/olivere/elastic"
)
func main() {
@deadcheat
deadcheat / calendar.dart
Created March 19, 2018 10:40
カレンダー作る手がかり
final today = new DateTime.now();
final lastday = new DateTime(today.year, today.month+1, 0);
final firstday = new DateTime(today.year, today.month,1);
final calendar = new List.generate(35, (i) =>
new DateTime(firstday.year, firstday.month, firstday.day + (i-firstday.weekday))
);
@deadcheat
deadcheat / main.go
Last active August 25, 2017 08:50
Bool判定 VS ErrNil判定
package main
import (
"errors"
"fmt"
"time"
)
func main() {
boolWin := 0
@deadcheat
deadcheat / main.go
Created March 4, 2017 18:55
なんか雑に書いた、与えられた年月の一月分を回すぜ.go
package main
import (
"flag"
"os"
"time"
"github.com/k0kubun/pp"
)
@deadcheat
deadcheat / main.go
Created February 27, 2017 12:26
ファイルの変更を検知してサーバーを再起動するサンプル
package main
import (
"fmt"
"log"
"time"
"net/http"
"github.com/radovskyb/watcher"
@deadcheat
deadcheat / Main.java
Created January 20, 2017 10:19
FactoryMethodパターンの例を作ろうとして霧の中に迷い込んだ
import java.util.Arrays;
import java.util.List;
public class Main {
public static void main(String[] args) {
List<Menu> orders = Arrays.asList(Menu.French, Menu.Sushi, Menu.French, Menu.Sushi);
orders.forEach(order -> ChefFactoryManager.build().assignChef(order).cook());
@deadcheat
deadcheat / test.html
Created January 19, 2017 15:04
bulma-tab+jqueryでactive
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
@deadcheat
deadcheat / cors.go
Created October 5, 2016 18:56
CORS Middleware so much inspired by labstack/echo/middleware/cors.go for goadesign/goa framework
package cors
import (
"net/http"
"strconv"
"strings"
"github.com/goadesign/goa"
"golang.org/x/net/context"
)
@deadcheat
deadcheat / ExampleTest.php
Created September 21, 2016 12:14
自作のModelサンプル
<?php
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class ExampleTest extends TestCase
{
/**
* A basic functional test example.