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 "async/barrier" | |
# A GraphQL::Dataloader implementation that uses the async gem all the way | |
# to be compatible with running on falcon. | |
# Uses private API, so be careful when upgrading graphql-ruby | |
class AsyncDataloader | |
def self.use(schema) | |
schema.dataloader_class = self | |
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
ALTER TABLE aspect_memberships | |
DROP CONSTRAINT aspect_memberships_aspect_id_fkey, | |
ADD CONSTRAINT aspect_memberships_aspect_id_fkey FOREIGN KEY (aspect_id) REFERENCES aspects(id) ON DELETE CASCADE; | |
ALTER TABLE aspect_memberships | |
DROP CONSTRAINT aspect_memberships_contact_id_fkey, | |
ADD CONSTRAINT aspect_memberships_contact_id_fkey FOREIGN KEY (contact_id) REFERENCES contacts(id) ON DELETE CASCADE; | |
ALTER TABLE aspect_visibilities | |
DROP CONSTRAINT aspect_visibilities_aspect_id_fkey, | |
ADD CONSTRAINT aspect_visibilities_aspect_id_fkey FOREIGN KEY (aspect_id) REFERENCES aspects(id) ON DELETE CASCADE; | |
ALTER TABLE comment_signatures |
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 | |
# frozen_string_literal: true | |
require "bundler/inline" | |
gemfile do | |
source "https://rubygems.org" | |
gem "octokit" | |
gem "terminal-table" |
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/ruby | |
require "bundler/inline" | |
gemfile(ARGV.any? {|arg| arg == "--install"}) do | |
source "https://rubygems.org" | |
gem "http", "~> 2.2" | |
gem "ADB", "~> 0.5.6" | |
gem "slop", "~> 4.5" | |
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
struct Slice(T) | |
def []?(start, count) | |
if start + count >= size | |
count = -1 | |
end | |
if count < 0 | |
count = size - start + (count + 1) | |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Barcode generator</title> | |
<script src="https://cdn.jsdelivr.net/jsbarcode/3.5.8/JsBarcode.all.min.js"></script> | |
<script src="https://code.jquery.com/jquery-3.1.1.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script> | |
<script type="text/javascript"> | |
window.eanHistory = []; | |
function loadHistory() { |
Hacking CORS restriction to enable in-browser XHR to any server.
Say you are running an web app at localhost, and you want to send XHR to http://remote-server:80
, but the CORS restriction forbids access because you are sending requests from an origin that remote-server:80 does not allow.
Run:
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 "option_parser" | |
require "http/server" | |
require "json" | |
class Settings | |
property port = 3000 | |
property host = "127.0.0.1" | |
property? show_headers = false | |
property? show_raw_json = false | |
end |
NewerOlder