Skip to content

Instantly share code, notes, and snippets.

# frozen_string_literal: true
class PracticalFramework::Components::Pagination < Phlex::HTML
include Pagy::Frontend
include FontAwesomeHelpers::ViewHelpers
include Phlex::Rails::Helpers::FormWith
include Phlex::Rails::Helpers::ContentTag
include Phlex::Rails::Helpers::HiddenFieldTag
attr_reader :request
attr_accessor :pagy, :item_name, :i18n_key
// Example Swift configuration Actor; where the idea originated
actor WorkoutAppConfiguration {
static let instance = WorkoutAppConfiguration()
public let authenticationSessionSchema: String
public let HealthKitIdentifier: String
init(){
self.authenticationSessionSchema = Bundle.main.infoDictionary!["AUTHENTICATION_SERVICES_CALLBACK_SCHEME"] as! String
@tcannonfodder
tcannonfodder / .circleci-config.yml
Created January 26, 2024 01:24
Practical Framework code quality setup
# Use the latest 2.1 version of CircleCI pipeline process engine.
# See: https://circleci.com/docs/configuration-reference
version: 2.1
rails_build: &rails_build
resource_class: small
docker:
- image: cimg/ruby:3.2-browsers
- image: cimg/postgres:16.1
environment:
@tcannonfodder
tcannonfodder / tiptap_document.rb
Created January 7, 2024 00:06
Tiptap document renderer using Phlex
# prototype extracted from the Practical Framework
class PracticalFramework::Components::TiptapDocument < Phlex::HTML
class UnknownNodeTypeError < StandardError; end
class UnknownMarkupTypeError < StandardError; end
module NodeRendering
def render_node(node:)
case node[:type].to_sym
when :text
@tcannonfodder
tcannonfodder / timer-broadcasts-server.rb
Created October 2, 2020 17:38
A Sinatra server that listens for broadcasts from Noko, and gets the latest status of a timer
require 'sinatra'
require 'json'
require 'openssl'
require 'byebug'
require 'httparty'
NOKO_TOKEN = "YOUR TOKEN"
BROADCAST_RECEIVER_NAME = "Timer Status"
PAYLOAD_URI = "YOUR URI"
<main>
<section id='login-sections'>
<section id="signin" class="login-section">
<h2>Sign in</h2>
<form>
<div>
<label for='email'>email</label>
<input type="email" id="email" name="email" required>
</div>
@tcannonfodder
tcannonfodder / app.rb
Created April 28, 2020 15:25
Noko Webhooks Tester server
require 'sinatra'
require 'json'
require 'openssl'
def read_payload(secret, request)
body = request.body.read
push = JSON.parse(body)
given_signature = request.env["HTTP_X_NOKO_SIGNATURE"]
signature = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), secret, body)
EventTarget.prototype._addEventListener = EventTarget.prototype.addEventListener;
EventTarget.prototype.addEventListener = function(a,b,c) {
if(c==undefined)
c=false;
this._addEventListener(a,b,c);
if(!window.eventListenerList)
window.eventListenerList = {};
if(!window.eventListenerList[a])
window.eventListenerList[a] = [];
//this.removeEventListener(a,b,c); // TODO - handle duplicates..
@tcannonfodder
tcannonfodder / Soda Light.sublime-theme
Created June 6, 2018 18:10
Modified Soda Light sublime theme, making the active tabs and minimap purple
[
// TABS
{
"class": "tab_label",
"parents": [{"class": "tab_control","attributes": ["selected"]}],
"shadow_offset": [0,0],
"fg": [255, 255, 255] // 06
},
{
"class": "tab_control",
using UnityEngine;
using System.Collections;
using System;
namespace Telemachus
{
public class CameraCapture : MonoBehaviour
{
public RenderTexture overviewTexture;
Camera OVcamera = null;