This file contains 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
require "github_api" | |
require "csv" | |
github = Github.new basic_auth: 'login:password' | |
users = github.activity.starring.list(user: 'username', repo: 'repo', auto_pagination: true) | |
CSV.open("users.csv", "wb") do |csv| | |
csv << ["User", "Location"] | |
users.each { |user| csv << [user.login, github.search.legacy.users(user.login).body.users[0].location] } | |
end |
This file contains 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
require 'fileutils' | |
file = File.open('list.txt', 'r') | |
File.open('shard.yml', 'w') do |f1| | |
f1.puts "name: 100projects\nversion: 0.1.0\n\nauthors:\n - <>\n\ntargets:\n" | |
while line = file.gets | |
filename = line.strip.gsub(/[^\w\.]/, '_').downcase | |
f1.puts " #{filename}:\n main: src/#{filename}/main.cr" | |
FileUtils::mkdir_p "src/#{filename}" | |
File.new "src/#{filename}/main.cr", 'w' |
This file contains 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
### Keybase proof | |
I hereby claim: | |
* I am daniel-worrall on github. | |
* I am dworrall (https://keybase.io/dworrall) on keybase. | |
* I have a public key ASAo7lE1O6SGkZcOx0Se7O3xMib9j4QBgQKOaNg8n_2fWAo | |
To claim this, I am signing this object: |
This file contains 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
.wrapper-1Rf91z { | |
width: 130px !important; | |
} | |
.wrapper-1Rf91z .scrollerWrap-2lJEkd { | |
width: 148px; | |
} | |
.scroller-2TZvBN { | |
padding-left: 0px; | |
} | |
.scroller-2TZvBN > div[class=""] { |
This file contains 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
folder_name = "" # Dir.pwd | |
volumes = %x`docker volume ls` | |
arr = [] | |
volumes.scan(/local\s*(\w*)/) { |x| arr << x[0] } | |
arr.reject!{ |x| x =~ /^[0123456789abcdef]+$/ } | |
arr.each do |volume_name| | |
p %x`docker run --rm -v #{volume_name}:/volume_data -v #{folder_name}:/backup ubuntu tar cvf /backup/#{volume_name}.tar /volume_data` | |
end |
This file contains 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
crystal ./src/test.cr --release | |
{"hub" => "https://api.twitch.tv/helix/webhooks/hub", | |
"self" => "https://api.twitch.tv/helix/users/follows?first=1&from_id=1337"} | |
{"hub" => "https://api.twitch.tv/helix/webhooks/hub", | |
"self" => "https://api.twitch.tv/helix/users/follows?first=1&from_id=1337"} | |
{"hub" => "https://api.twitch.tv/helix/webhooks/hub", | |
"self" => "https://api.twitch.tv/helix/users/follows?first=1&from_id=1337"} | |
{"hub" => "https://api.twitch.tv/helix/webhooks/hub", | |
"self" => "https://api.twitch.tv/helix/users/follows?first=1&from_id=1337"} | |
1 325.74k ( 3.07µs) (± 7.74%) 2.16kB/op 2.30× slower |
This file contains 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
#!/bin/sh | |
changed_cr_files=$(git diff --cached --name-only --diff-filter=ACM | grep '\.cr$') | |
[ -z "$changed_cr_files" ] && exit 0 | |
crystal tool format $changed_cr_files | |
shards check || exit 1 | |
bin/ameba -f flycheck $changed_cr_files || exit 1 |
This file contains 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
class Anime | |
include JSON::Serializable | |
property id : Int32 | |
property title : String | |
property alt_title : String? | |
property season : Int32 | |
@[JSON::Field(converter: BoolConverter)] | |
property ongoing : Bool | |
property hb_id : Int32? | |
@[JSON::Field(converter: TimeConverter)] |
This file contains 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
version: 2 | |
jobs: | |
build: | |
working_directory: ~/<%= config.name %> | |
docker: | |
- image: crystallang/crystal:latest | |
steps: | |
- checkout | |
- restore_cache: | |
key: dependency-cache-{{ checksum "shard.lock" }} |
This file contains 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
day = 12 | |
suffix = case {day % 10, day % 100} | |
when {.==(1), .!=(11)} | |
"st" | |
when {.==(2), .!=(12)} | |
"nd" | |
when {.==(3), .!=(13)} | |
"rd" | |
else |
OlderNewer