Skip to content

Instantly share code, notes, and snippets.

View merlinstardust's full-sized avatar

Merlin (they/them) merlinstardust

View GitHub Profile
merlinstardust / RainbowText.jsx
Created July 5, 2023 17:58
Rainbow Text using enchanted land font
View RainbowText.jsx
import localFont from 'next/font/local';
const enchantedLandFont = localFont({ src: './enchanted-land.ttf' });
const headerStyle = (colors) => ({
display: 'inline',
margin: 0,
fontSize: 500,
fontWeight: 400,
background: `-webkit-linear-gradient(left, ${colors.join(', ')})`,
merlinstardust / blockSites
Last active October 31, 2020 15:49
Block sites
View blockSites localhost
merlinstardust / store.js
Created July 19, 2018 18:03
Use Proxy and Meteor Mongo to create a reactive store
View store.js
import {Mongo} from 'meteor/mongo';
const StoreCollection = new Mongo.Collection('Store', {connection: null});
const objectPrototypeKeys = Object.getOwnPropertyNames(Object.prototype);
const getSubId = (key, subKey) => key + subKey[0].toUpperCase() + subKey.slice(1);
const store = new Proxy({}, {
get(target, key, receiver) {
if (objectPrototypeKeys.includes(key)) {
merlinstardust / LayoutWithPackageContext.js
Last active July 19, 2018 16:05
A possible way to use Meteor packages with React context and dynamic imports
View LayoutWithPackageContext.js
import React from 'react';
import MeteorPackages from './MeteorPackages';
import context from './context';
const Layout = ({content}) => {
return (
<div className={`Layout ${themeClass}`}>
<MeteorPackages.Provider value={context}>
merlinstardust / uses_of_moment.txt
Created August 9, 2017 21:53
Uses of Moment in Chart.js
View uses_of_moment.txt
docs/ provides two different builds that are available for your use. The `Chart.js` and `Chart.min.js` files include Chart.js and the accompanying color parsing library. If this version is used and you require the use of the time axis, [Moment.js]( will need to be included before Chart.js.
docs/ | String or Function | - | If defined as a string, it is interpreted as a custom format to be used by moment to parse the date. If this is a function, it must return a moment.js object given the appropriate data value.
docs/ | String | '' | The moment js format string to use for the tooltip.
docs/ providing data for the time scale, Chart.js supports all of the formats that Moment.js accepts. See [Moment.js docs]( for details.
docs/ following display formats are used to configure how different time units are formed into strings for the axis tick marks. See
merlinstardust / meteor_add_association_helpers.js
Last active April 5, 2016 17:51
Goes through all collections and attaches association helpers to them
View meteor_add_association_helpers.js
var collections = [];
_.each(collections, function (collection) {
var helpers = {};
var fields = window[relation].simpleSchema().objectKeys();
_.each(fields, function (field) {
var key = field.replace(/Id$/, '');
helpers[key] = function () {
var entity = capitalize(key) + 's';
return window[entity].findOne({_id: this[field]});
merlinstardust / synergy_configs.sgc
Last active March 12, 2016 17:27
Synergy Mouse and Keyboard Sharing Configurations
View synergy_configs.sgc
# Home
section: screens
section: links
left = Avalon
right = Avalon
merlinstardust / mount_node_vagrant.rb
Created March 10, 2016 16:36
Mounts Node node_modules directories within Vagrant so apps can run
View mount_node_vagrant.rb
config.vm.provision "node_modules mounting", type: "shell", run: "always" do |shell|
shell.privileged = false
shell.args = "'#{app_name}'"
shell.inline = <<-SHELL
echo "Mounting node_modules directories"
for directory in /$1/*; do
if [ -f $directory/package.json ]; then
mkdir -p $directory/node_modules
mkdir -p /home/vagrant$directory/node_modules
sudo mount --bind /home/vagrant$directory/node_modules $directory/node_modules
merlinstardust / mount_meteor_vagrant.rb
Created March 10, 2016 16:34
Mounts Meteor local directories within Vagrant so apps can run
View mount_meteor_vagrant.rb
config.vm.provision ".meteor mounting", type: "shell", run: "always" do |shell|
shell.privileged = false
shell.args = "'#{app_name}'"
shell.inline = <<-SHELL
echo "Mounting .meteor/local directories"
for directory in /$1/*; do
if [ -d $directory/.meteor ]; then
mkdir -p $directory/.meteor/local
mkdir -p /home/vagrant$directory/.meteor/local
sudo mount --bind /home/vagrant$directory/.meteor/local $directory/.meteor/local
View directories.rb
full_path = File.expand_path(File.dirname(__FILE__))
vm_directory = directory = File.basename(full_path)
parent_path_with_sep = full_path.gsub( + "$"), '')
separator = parent_path_with_sep[-1]
parent_path = parent_path_with_sep.gsub( + "$"), '')
i = parent_path.rindex(separator)
app_name = parent_directory = parent_path[i + 1..- 1]
puts app_name