Skip to content

Instantly share code, notes, and snippets.

View motemen's full-sized avatar
🌴
On vacation

Hironao OTSUBO motemen

🌴
On vacation
View GitHub Profile
@motemen
motemen / test.pl
Last active November 11, 2016 06:34
$] = 5.008008
$URI::VERSION = 1.71
https://www.example.com?hoge=%E3%81%BB%E3%81%92
https://www.example.com?hoge=%C3%A3%C2%81%C2%BB%C3%A3%C2%81%C2%92&foo=bar
use strict;
use warnings;
use HTTP::Tiny;
use JSON;
use App::cpanminus::fatscript;
my $dist = shift;
my $dep = shift;
my $version = shift;
sig Person {
shaken: set Person,
partner: Person
}
fact partnerProperties {
partner = ~partner
no p: Person | p in p.partner
}
http://api.metacpan.org/v0/release/_search?source={%20%22query%22:%20{%20%22filtered%22:%20{%20%22query%22:%20{%20%22match_all%22:%20{}%20},%20%22filter%22:%20{%20%22and%22:%20[%20{%20%22term%22:%20{%20%22distribution%22:%20%22Net-CIDR-MobileJP%22%20}%20},%20{%20%22nested%22:%20{%20%22path%22:%20%22dependency%22,%20%22filter%22:%20{%20%22and%22:%20[%20{%20%22term%22:%20{%20%22dependency.module%22:%20%22WWW::MobileCarrierJP%22%20}%20},%20{%20%22term%22:%20{%20%22dependency.version_numified%22:%200%20}%20}%20]%20}%20}%20}%20]%20}%20}%20}%20}
var spawn = require('child_process').spawn;
var depth = process.argv[2];
if (!depth) {
var p = spawn('node', [ process.argv[1], '1' ], { stdio: 'inherit' });
setTimeout(() => {
console.log(process.pid, 'Killing child', p.pid);
p.kill();
}, 500);
An example simple repository.
@motemen
motemen / ghq.sbt
Last active January 26, 2016 10:44
lazy val ghqGetDepndencies = taskKey[Unit]("""Download dependencies using "ghq get".""")
ghqGetDepndencies <<= (ivyPaths, libraryDependencies, streams) map {
(ivyPaths, libraryDependencies, s) =>
new IvyCache(ivyPaths.ivyHome).withDefaultCache(None, s.log) {
cache =>
libraryDependencies.foreach {
m =>
import org.apache.ivy.core.module.id.ModuleRevisionId
import scala.collection.JavaConversions._
{
"action": "synchronize",
"number": 2,
"pull_request": {
"url": "https://api.github.com/repos/motemen/test-repository/pulls/2",
"id": 17160832,
"html_url": "https://github.com/motemen/test-repository/pull/2",
"diff_url": "https://github.com/motemen/test-repository/pull/2.diff",
"patch_url": "https://github.com/motemen/test-repository/pull/2.patch",
"issue_url": "https://api.github.com/repos/motemen/test-repository/issues/2",
watchSources ~= {
_.filterNot {
f =>
f.isDirectory ||
"""^\..*\.sw.$""".r.findFirstIn(f.getName).isDefined
}
}
lazy val ghqGetDepndencies = TaskKey[Unit]("ghq-get-dependencies")