Let's have some command-line fun with curl, [jq][1], and the [new GitHub Search API][2].
Today we're looking for:
# Write an adventure game that the player plays from the command line | |
# by typing in the commands `north` and `south`. The game should have | |
# this behaviour: | |
# * Two rooms: a passage and a cave. | |
# * Passage commands | |
# * `north`: `puts`es `You are in a scary cave.` | |
# * Cave commands | |
# * `south`: `puts`es `You are in a scary passage.` | |
# * `north`: `puts`es 'You walk into sunlight.` and the program | |
# stops executing. |
def weirdcase(string) | |
#TODO | |
array = string.split(" ") | |
if array.size > 0 | |
array.each { |word| | |
word.each_char{ |char| | |
if word.index(char).even? | |
word[index] = letter.upcase | |
end | |
} |
Let's have some command-line fun with curl, [jq][1], and the [new GitHub Search API][2].
Today we're looking for:
# encoding: utf-8 | |
if defined?(Encoding) then | |
Encoding.default_external = 'utf-8' | |
Encoding.default_internal = 'utf-8' | |
else | |
$KCODE = 'utf-8' | |
end | |
ENV["LANG"] = 'en_US.UTF-8' |
require 'irb' | |
module IRB | |
def self.start_session(binding) | |
IRB.setup(nil) | |
workspace = WorkSpace.new(binding) | |
if @CONF[:SCRIPT] | |
irb = Irb.new(workspace, @CONF[:SCRIPT]) |
#!/bin/sh | |
### | |
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer) | |
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos | |
### | |
# Alot of these configs have been taken from the various places | |
# on the web, most from here | |
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx |
A brief example on how to use npx
to run gist based scripts.
Read the article here https://neutrondev.com/npm-vs-npx-whats-the-difference/
When you create a npm package, remember it might be used in a browser or a server, or even a command line utility… For each package you create, please pay attention at what it will be used for: