Skip to content

Instantly share code, notes, and snippets.

View Daniel-Worrall's full-sized avatar

Daniel Worrall Daniel-Worrall

View GitHub Profile
### 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:
@Daniel-Worrall
Daniel-Worrall / crystal.rb
Created June 13, 2017 23:17
Crystal Project of a lot of mini projects from a list, from Ruby
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'
@Daniel-Worrall
Daniel-Worrall / github_location.rb
Created May 13, 2017 16:37
Get list of user locations from github star list in Ruby
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