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
def css(selector) | |
html.css(selector).text | |
end | |
def html | |
Nokogiri::HTML(response.body) | |
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
-include Makefile.local # for optional local options | |
DOC_SOURCE ::= src/** | |
BUILD_TARGET ::= bin/app | |
# The shards command to use | |
SHARDS ?= shards | |
# The crystal command to use | |
CRYSTAL ?= crystal |
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
# EvalRuby: Run Ruby without leaving Neovim | |
# | |
# Usage: | |
# - While on a line of Ruby, or in Visual mode | |
# with multiple lines selected, type :EvalRuby. | |
# | |
# Installation: | |
# 1. Install neovim-ruby: https://github.com/neovim/neovim-ruby | |
# | |
# 2. Put this file in your plugins directory |
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
# $ ruby -v | |
# ruby 3.2.0dev (2022-09-11T14:08:14Z master 684353fc03) [x86_64-linux] | |
# $ ruby --mjit=pause --mjit-wait --mjit-min-calls=5 hawthjit.rb | |
# 246 | |
# 246 | |
# 246 | |
# 246 | |
# attempting to compile block in <main> | |
# can't compile putself | |
# attempting to compile double |
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
language: rust | |
cache: cargo | |
rust: | |
- stable | |
before_cache: | | |
cargo install cargo-tarpaulin | |
before_script: | |
- rustup component add rustfmt | |
- rustup component add clippy | |
- cargo install cargo-audit |
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
name: Security audit | |
on: | |
push: | |
paths: | |
- '**/Cargo.toml' | |
- '**/Cargo.lock' | |
jobs: | |
security_audit: | |
runs-on: ubuntu-latest | |
steps: |
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
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
# frozen_string_literal: true | |
require 'pry' | |
require 'json' | |
require 'rest-client' | |
WIKIDATA_SPARQL_URL = 'https://query.wikidata.org/sparql' |
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
#=== Real life examples === | |
graph = RDF::Graph.new | |
# read from file | |
graph = RDF::Graph.load("http://datagraph.org/jhacker/foaf.nt") | |
# -or- from the web | |
graph = RDF::Graph.load("http://dbpedia.org/resource/Elvis_Presley") | |
graph << RDF::RDFa::Reader.open("http://www.bestbuy.com/shop/ipad+xoom+-windows") | |
graph.each_predicate { |s| puts s.inspect } |
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 'kramdown' | |
require 'redcarpet' | |
require 'toml' | |
require 'yaml' | |
# | |
# pool | |
# | |
class WorkerPool |
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 Broadcaster | |
attr_reader :ractor | |
def initialize | |
@ractor = new_ractor | |
end | |
def new_ractor | |
Ractor.new { Ractor.recv rescue nil } | |
end | |
def broadcast(message) | |
next_ractor = new_ractor |
NewerOlder