Skip to content

Instantly share code, notes, and snippets.

ryanckulp / active_admin.rake
Last active April 3, 2024 22:16
for using ActiveAdmin v4 without node/yarn on Rails 7
namespace :active_admin do
"-i", Rails.root.join("app/assets/stylesheets/active_admin.css").to_s,
"-o", Rails.root.join("app/assets/builds/active_admin.css").to_s,
"-c", Rails.root.join("config/tailwind-active_admin.config.js").to_s,
"-m" # minify
desc "Build Active Admin Tailwind stylesheets"
ryanckulp /
Created November 12, 2023 22:26 — forked from leastbad/
Choices.js Stimulus wrapper preview

Choices.js Stimulus wrapper

Soon, this will be published as an NPM package, but there's an absence of documentation right now. It supports almost all functions from the original library; soon it will support 100% of them.

This wrapper adds Ajax pre-fetch search. Happens if controller has a data-search-path attribute.

Stimulus controller targets use new v2 syntax. Controller attaches a reference to itself on the element so that you can access the internal state from external scripts.

ryanckulp / SwordNFT.sol
Created January 25, 2022 04:35 — forked from Chmarusso/SwordNFT.sol
Learn how to create truly immutable smart contracts (Ethereum / EVM) that can hold all metadata and SVG images on-chain
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
library Base64 {
string internal constant TABLE_ENCODE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
bytes internal constant TABLE_DECODE = hex"0000000000000000000000000000000000000000000000000000000000000000"
ryanckulp / KlaytnContractTemplate.sol
Last active January 15, 2022 09:48 -- Klaytn Smart Contract Template
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
# While in IRB, use the Ruby JSON library with:
require 'json'
# Then pass stringifed JSON content into it, surrounded by single quotes:
JSON.parse('stringified json here')
# In this lecture we learned a new Hash method:
# This will remove by the key AND the key's corresponding value from a hash.
this, that = ARGV
one, two, three = [1, 2, 3]
# Multi-line inner loop blocks
collection.each do |parameter_name|
# logic_here
# Single-line inner loop blocks
collection.each { |parameter_name| logic_here }
def +(parameter_here)
# logic here
"string".gsub("g", "") # => "strin" (new value)
"string".gsub!("g", "") # => "strin" (modified original value)
hash = { person: "Ryan" }
# => { "person" => "Ryan" } you should see this result after hitting enter