Skip to content

Instantly share code, notes, and snippets.

<h1><%= @name_plural %></h1>
<%% @<%= @name_plural %>.each do |<%= @name_singular %>| %>
<li><a href="/<%= @name_plural %>/<%%= <%= @name_singular %>.id %>"><%%= <%= @name_singular %>.id %></a></li>
<ul>
<%%= @attributes.each do |attribute| %>
<li><%%= attribute %>: <%%= <%= @name_singular %> %>.<%%= attribute %></li>
<%% end %>
</ul>
<%% end %>
</ul>
require 'sinatra'
# require and use controllers from within the `./controller` directory
controller_paths = Dir["./controllers/*.rb"].each { |file| require_relative file }
controllers = controller_paths.map { |controller_path| controller_path[/controllers\/(.*?)_controller/m, 1] }
controllers.each { |controller| use Object.const_get("#{controller.capitalize}Controller") }
General:
0 - Attack
1 - Kick
2 - Throw
3 - Unsummon
4 - Left Hand Throw
5 - Left Hand Swing
Amazon:
6 - Magic Arrow
@ogryzek
ogryzek / character_config.md
Last active March 14, 2022 21:08
Some Character Config Settings for Kolbot

Character Config for Kolbot - Quick Reference

Attack skill reference

General

Inventory

0 to not touch, 1 if you don't care about that slot:

// 1.) Write a function `cigs()` that takes an argument `perHour`, and
// logs "You smoke (however many perHour) cigs per hour."
function cigs(perHour) {
first = "You smoke ";
middle = perHour;
last = " cigs per hour.";
msg = first + middle + last;
console.log(msg);
}
@ogryzek
ogryzek / aws_shippable_docker.md
Last active November 24, 2017 16:27
code_snippets
@ogryzek
ogryzek / log_example.go
Last active July 15, 2016 23:02
Messing around with writing logs to a file in Go (Golang)
// log_example.go
package main
import (
"fmt"
mypackage "github.com/ogryzek/log_practice/mypackage"
"log"
"net/http"
"os"
)
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
var ThirdPartyApi = "http://www.coolsongssite.api"
@ogryzek
ogryzek / translate_json.go
Last active May 17, 2016 06:00
Take a json request and output json with the same data but different keys.
package main
import (
"encoding/json"
"fmt"
"net/http"
)
type Greetings struct {
Greetings []Greeting `json:"data"`
@ogryzek
ogryzek / family.go
Last active May 10, 2016 23:59
Go api endpoint to handle creating nested structs from json data
/* `go run family.go` to run this on your localhost at port 3000
curl -X POST -d '{"family_name": "Smith", \
"members": [{"role": "parent", "gender": "female" \
, "age": 33}, {"role": "child", "gender": "male", "age": 5}, \
{"role": "parent", "gender": "male", "age": 40}]}' \
http://localhost:3000/family/new
Will print the following to the console: