Skip to content

Instantly share code, notes, and snippets.

View stevenspiel's full-sized avatar

Steven Spiel stevenspiel

View GitHub Profile
@stevenspiel
stevenspiel / paper_trail_spec.rb
Last active March 30, 2016 20:03
Tests that all ActiveRecord models are using paper_trail. It finds all classes that inherit from ActiveRecord::Base and checks to see if :paper_trail_options is defined on each one.
require 'rails_helper'
describe 'paper_trail' do
before { Rails.application.eager_load! }
let(:excluded_classes) { [ActiveRecord::SchemaMigration, PaperTrail::Version, PaperTrail::VersionAssociation] }
let(:models) { ActiveRecord::Base.descendants - excluded_classes }
it 'is implemented in all ActiveRecord::Base models' do
expect(models).to all(respond_to(:paper_trail_options))
end
Verifying my Blockstack ID is secured with the address 1EEQfALCUFNQ6EYMPx2KfytxgdVTtJbAZd https://explorer.blockstack.org/address/1EEQfALCUFNQ6EYMPx2KfytxgdVTtJbAZd
@stevenspiel
stevenspiel / example.dart
Created February 26, 2022 22:04
DraggableScrollableSheet example
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
@stevenspiel
stevenspiel / to_hex.dart
Created July 18, 2024 17:22
Convert to hex
import 'dart:convert';
import 'dart:typed_data';
void main() {
String input = "";
Uint8List hexDecoded = hexToBytes(input);
Uint8List base64Decoded = base64Decode(hexDecoded);
String hexEncoded = bytesToHex(base64Decoded);
print(hexEncoded);
}
@stevenspiel
stevenspiel / utility.dart
Last active January 26, 2025 15:53
Utility to convert base64-encoded strings to hex
import 'dart:convert';
// Utility to convert base64-encoded strings to hex
void main() {
String base64PublicKey = "";
print(base64Decode(base64PublicKey)
.map((e) => e.toRadixString(16).padLeft(2, '0'))
.join());
}