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
# TODO: Write documentation for `CanMapper` | |
module CanMapper | |
VERSION = "0.1.0" | |
# TODO: Put your code here | |
end | |
class BitMapper(T) | |
property buffer : T |
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 "http" | |
require "random" | |
require "openssl/cipher" | |
require "crypto/subtle" | |
random = Random.new | |
key = random.random_bytes(32) | |
def encrypt(value : Bytes, key) |
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 "http" | |
require "random" | |
require "openssl/cipher" | |
require "crypto/subtle" | |
random = Random.new | |
key = random.random_bytes(32) | |
def encrypt(value : Bytes, key) |
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 "http" | |
require "random" | |
require "openssl/cipher" | |
require "crypto/subtle" | |
random = Random.new | |
key = random.random_bytes(32) | |
def encrypt(value : Bytes, key) |
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 Services::FitbitController < ApplicationController | |
access user: :all | |
def callback | |
logger.info params | |
logger.info "Hello********************************************************************************" | |
if params[:code] | |
current_user.services.update_all(expired: true) | |
current_user.services.create(code: params[:code]) | |
redirect_to root_path, notice: "Succesfully connected to Fitbit" |
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 "http" | |
ws = HTTP::WebSocket.new("127.0.0.1", "/ping", 3000) | |
# react to received messages | |
ws.on_message do |msg| | |
puts "recieved message: #{msg}." | |
end | |
# spawn a fiber that will forward messages from a channel |
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 ApiController < ApplicationController | |
def index | |
session[%w(a b c d e f g h i j k l m n o p).sample] = Time.now.to_s | |
respond_with do | |
json session.to_h.to_json | |
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
def select_field(name : String | Symbol, collection : Array(Array), **options : Object) | |
options_hash = Kit.safe_hash(options, {:name => name}) | |
selected = [options_hash.delete(:selected)].flatten.map(&.to_s) | |
content(element_name: :select, options: options_hash) do | |
String.build do |str| | |
collection.map do |item| | |
str << %(<option value="#{item[0]}"#{selected.includes?(item[0].to_s) ? %( selected="selected") : nil}>#{item[1]}</option>) | |
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
= form_for(@tank_configuration) do |f| | |
- if @tank_configuration.errors.any? | |
#error_explanation | |
h2 | |
= pluralize(@tank_configuration.errors.count, "error") | |
| prohibited this tank_configuration from being saved: | |
ul | |
- @tank_configuration.errors.full_messages.each do |msg| | |
li | |
= msg |
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
# == Schema Information | |
# | |
# Table name: images | |
# | |
# id :integer not null, primary key | |
# file :string(255) | |
# category :string(255) | |
# tank_configuration_id :integer | |
# created_at :datetime | |
# updated_at :datetime |
NewerOlder