Skip to content

Instantly share code, notes, and snippets.

🎶
Just keep coding, just keep coding

Chris Watson watzon

🎶
Just keep coding, just keep coding
Block or report user

Report or block watzon

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@watzon
watzon / GithubStarsButton.svelte
Created Jul 6, 2019
Svelete/Bulma Github stars button component
View GithubStarsButton.svelte
<script>
import axios from 'axios';
import { onMount } from 'svelte';
export let repo;
export let text = 'Github';
let count;
onMount(async () => {
@watzon
watzon / crystal-lang.org-sitemap.json
Created Jun 26, 2019
Sitemap of crystal-lang.org generated with Arachnid
View crystal-lang.org-sitemap.json
{
"https://crystal-lang.org": "The Crystal Programming Language",
"https://crystal-lang.org/community": "Community - The Crystal Programming Language",
"https://crystal-lang.org/blog": "Blog - The Crystal Programming Language",
"https://crystal-lang.org/2014/06/19/crystal-0.1.0-released.html": "Crystal 0.1.0 released! - The Crystal Programming Language",
"https://crystal-lang.org/api": "README - github.com/crystal-lang/crystal",
"http://crystal-lang.org/docs": "Introduction · GitBook",
"http://crystal-lang.org/installation/": "Page not found - The Crystal Programming Language",
"http://crystal-lang.org": "The Crystal Programming Language",
"http://crystal-lang.org/community": "Community - The Crystal Programming Language",
@watzon
watzon / delete-forks.cr
Created Jun 25, 2019
Deleting forks with octokit.cr
View delete-forks.cr
require "octokit"
client = Octokit.client(access_token: "***********************************0a937")
puts "Fetching repositories"
repos = client.repositories("watzon").fetch_all
puts "Selecting forks"
repos = repos.select { |r| r.fork == true }
View organization.cr
class Organization < BaseModel
table :organizations do
column name : String
column email : String
column profile_image_url : String?
column description : String?
column github_username : String?
column gitlab_username : String?
column twitter_username : String?
@watzon
watzon / shard.yml
Created Jun 17, 2019
Files for Tourmaline docker container
View shard.yml
name: tourmaline-bot
version: 0.1.0
authors:
- Your Mane <your@email.me>
crystal: 0.28.0
dependencies:
tourmaline:
View create_organization_members.cr
class CreateOrganizationMembers::V20190614161024 < Avram::Migrator::Migration::V1
def migrate
create :organization_member do
add_belongs_to user : User, on_delete: :cascade
add_belongs_to organization : Organization, on_delete: :cascade
add can_add_shards : Bool
add can_delete_shards : Bool
add can_edit_shards : Bool
add can_edit_info : Bool
@watzon
watzon / decorator_base.cr
Last active Jun 14, 2019
Testing decorator implementation with Lucky
View decorator_base.cr
abstract class DecoratorBase
private macro decorate(ident, name = nil)
@_{{ ident.id.stringify.downcase.id }} : {{ ident.id }}
forward_missing_to @_{{ ident.id.stringify.downcase.id }}
def initialize(@_{{ ident.id.stringify.downcase.id }} : {{ ident.id }})
end
end
@watzon
watzon / not_pwned_validation.cr
Created Jun 14, 2019
Lucky valdator to make sure a password isn't in the Have I Been Pwned database
View not_pwned_validation.cr
require "http/client"
require "openssl"
module NotPwnedValidation
def validate_not_in_hibp
password.value.try do |value|
hash = get_sha1_hash(value).upcase
first_five = hash[0...5]
response = HTTP::Client.get("https://api.pwnedpasswords.com/range/" + first_five)
hashes = response.body.split("\r\n")
@watzon
watzon / app.js
Last active Jun 14, 2019
Toggle password field with Lucky and stimulus
View app.js
import { Application } from 'stimulus'
import PasswordController from './controllers/password_controller'
const application = Application.start()
application.register("password", PasswordController)
View keybase.md

Keybase proof

I hereby claim:

  • I am watzon on github.
  • I am watzon (https://keybase.io/watzon) on keybase.
  • I have a public key ASAaZc4seSN-ph2udQzAl_qP_oBugNBvq57A5mKu5qQh1go

To claim this, I am signing this object:

You can’t perform that action at this time.