This file contains hidden or 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
// array of HTML elements to be parsed for headings and paragraphs | |
const htmlElements = document.querySelectorAll('h1,h2,h3,h4,h5,h6,p'); | |
// store paragraphs with their hierarchy of headings | |
const paragraphData: Array<[string[], string]> = []; | |
// store current hierarchy of headings | |
const stack: Element[] = []; | |
// iterate through all html elements | |
Array.from(htmlElements).map((element) => { |
This file contains hidden or 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
domain-needed | |
bogus-priv | |
domain=home.mysite.com | |
local=/home.mysite.com/ | |
expand-hosts | |
#log all dns queries | |
log-queries | |
#dont use hosts nameservers | |
no-resolv | |
no-poll |
This file contains hidden or 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' | |
services: | |
dns: | |
image: strm/dnsmasq | |
volumes: | |
- ./config/dnsmasq.conf:/etc/dnsmasq.conf | |
ports: | |
- "53:53" | |
network_mode: host | |
cap_add: |
This file contains hidden or 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
{ config, pkgs, ... }: | |
{ | |
programs.home-manager.enable = true; | |
programs.bat.enable = true; | |
programs.fzf.enable = true; | |
programs.fzf.enableZshIntegration = true; | |
home.packages = with pkgs; [ | |
entr | |
fd |
This file contains hidden or 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
before_action do | |
if current_user | |
&& current_user.is_admin? | |
&& params(:pp) | |
Rack::MiniProfiler.authorize_request | |
end | |
end |
This file contains hidden or 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 'redcarpet' | |
text = '*markdown!*' | |
# Initialize a Markdown parser | |
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML) | |
# render the text to HTML | |
markdown.render(text) # returns "<p><em>markdown!</em></p>" |
This file contains hidden or 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
# app/graphql/types/query_type.rb | |
Types::QueryType = GraphQL::ObjectType.define do | |
name "Query" | |
field :ticket, types.String do | |
resolve ->(obj, args, ctx) { | |
Concurrent::Future.execute do | |
BackendTicketService.fetch(1234) | |
end | |
} |
This file contains hidden or 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
# setup requests | |
request_one = Typhoeus.get("www.example.com") | |
request_two = Typhoeus.get("www.google.com") | |
request_three = Typhoeus.get("www.bing.com") | |
# initialize a "Hydra" for performing requests in parallel | |
hydra = Typhoeus::Hydra.new | |
hydra.queue(request_one) | |
hydra.queue(request_two) | |
hydra.queue(request_three) |
This file contains hidden or 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
# app/graphql/ticket_resolver.rb | |
class TicketResolver | |
def initialize(id) | |
@id = id | |
end | |
def ticket | |
if @ticket | |
@ticket | |
else |
This file contains hidden or 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 Tokenizer | |
TOKEN_TYPES = [ | |
[:def, /\bdef\b/], | |
[:end, /\bend\b/], | |
[:identifier, /\b[a-zA-Z]+\b/], | |
[:integer, /\b[0-9]+\b/], | |
[:oparen, /\(/], | |
[:cparen, /\)/], | |
[:comma, /,/] | |
] |
NewerOlder