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
| # KnockoutView provides a simple Opal-based Ruby wrapper around Knockout.js, a popular | |
| # front-end data-binding and events library. It uses the Observable module from Vienna, | |
| # another front-end library written in Ruby using Opal. | |
| # | |
| # Run one or more of these class methods in a KnockoutView subclass, aka | |
| # | |
| # ko_vars :somevar, :anothervar | |
| # ko_methods :clickme | |
| # | |
| # and then wrappers will be created for the JS model that is passed to Knockout |
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
| # Add node-runner to your site's Gemfile | |
| # Then place this file in your plugins folder… | |
| require "node-runner" | |
| class JSFrontMatter | |
| def initialize | |
| Bridgetown::Hooks.register :site, :pre_render do |site, payload| | |
| docs = (site.documents + site.pages).map{|doc| doc.to_liquid.to_h} |
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
| client = Graphlient::Client.new("https://api.github.com/graphql", headers: {"Authorization" => "bearer #{token}"}) | |
| resp = client.query do | |
| query do | |
| repository(owner: "jaredcwhite", name: "test-ruby-on-vercel") do | |
| description | |
| createdAt | |
| end | |
| 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
| say "I am a script from GitHub!" | |
| empty_directory "gh_dir" | |
| create_file "gh_dir/fun_party.rb" do | |
| hostname = ask("What is the virtual hostname I should use?") | |
| "vhost.name = #{hostname}" | |
| 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
| run "filedoesnotexist" |
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
| import { LitElement, html } from "lit-element" | |
| class UpcaseReverse extends LitElement { | |
| connectedCallback() { | |
| super.connectedCallback() | |
| const observer = new MutationObserver(this.requestUpdate.bind(this)); | |
| observer.observe(this, { characterData: true, subtree: true }) | |
| } |
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
| module I | |
| class Have | |
| def self.a | |
| ruby = Struct.new(:Ruby) | |
| joke = Struct.new(:joke) | |
| ruby.new(joke.new("HAHA")) | |
| end | |
| 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
| #!/usr/bin/env bash | |
| # Utilize https://github.com/jkphl/svg-sprite | |
| svg-sprite --symbol --dest=src/images --symbol-dest="" --symbol-sprite="icons.svg" frontend/icons/*.svg |
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
| one_liner = Class.new { def self.print_me!() = puts("A class method on one line!") } | |
| one_liner.print_me! | |
| # Copy and try it out at https://rubyapi.org/repl |
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
| import { LitElement, html } from "lit-element"; | |
| // Lambda for determining default node action | |
| let defaultActionForNode = (node) => { | |
| switch (node.nodeName.toLowerCase()) { | |
| case "form": | |
| return "submit"; | |
| case "input": | |
| case "textarea": |
OlderNewer