Skip to content

Instantly share code, notes, and snippets.

kitop / proxy.rb.diff
Created Nov 13, 2020
Mongoid public method issue
View proxy.rb.diff
diff --git a/lib/mongoid/association/proxy.rb b/lib/mongoid/association/proxy.rb
index 6392cb799..91ecf7126 100644
--- a/lib/mongoid/association/proxy.rb
+++ b/lib/mongoid/association/proxy.rb
@@ -100,6 +100,14 @@ def substitutable
+ def send(method, *args)
+ if respond_to?(method)
kitop / repro.rb
Last active Oct 17, 2020
Mongo relationship issue
View repro.rb
require 'bundler/inline'
gemfile do
source ''
gem 'mongoid', '~> 7.1.4'
gem 'minitest', '~> 5.14.1', require: ['minitest', 'minitest/autorun']
class Parent
include Mongoid::Document
kitop / twitter-cards.liquid
Created Sep 16, 2013
Twitter Cards Snippet for Shopify Stores
View twitter-cards.liquid
{% comment %}
This is for widgets that share content on Twitter.
Twitter developer info:
Brought to you by Viralica
{% endcomment %}
{% if template contains 'product' %}
<meta name="twitter:card" content="product">
<meta name="twitter:title" content="{{ product.title }}" />
<meta name="twitter:description" content="{{ product.description | strip_html | strip_newlines | truncatewords: 160, '' | escape }}" />
View netlify.js
#!/usr/bin/env /usr/local/bin/node
const https = require("https");
const url = require("url");
const querystring = require('querystring')
// All my images as base64 strings
const imgLogo =
kitop /
Last active Feb 16, 2018 — forked from pyreta/
New Playlist Features

New Playlist Features

In addition to some visual differences (new icons, etc.), some new features have been added to the playlist folder tree:

1) Right-click to access dropdown menu + shortcuts

  • Dropdown menu is accessed by right-clicking instead of clicking gear icon
  • Shortcut icons now appear in place of gear icon. These shortcuts include:
    • Playlist Header: new folder, new playlist
    • Playlists: wrap, report, and share
    • Folders (owned): create playlist, sharing options
    • Folders (not owned): sharing details
View LinkList.elm
View app-assets-javascripts-elm-HelloWorld.js
const Elm = require("../../elm/HelloWorld.elm")
window.registerApp({ HelloWorld: Elm.HelloWorld })
kitop /
Created Mar 31, 2017
Template Bash Script
#!/usr/bin/env bash
set -euo pipefail
# Taken from
#/ Usage:
#/ Description:
#/ Examples:
#/ Options:
kitop / post-commit
Last active Jan 2, 2016
Git post commit hook to remind to precompile some assets
View post-commit
# A hook script to remind us to precompile the assets.
NC='\033[0m' # No Color
changes=$(git diff --name-only HEAD^)
View products_controller.rb
class ProductsController < ApplicationController
def preview
ActiveRecord::Base.transaction do
if request.referer =~ %r{/admin/products/(.+)/edit}
@product = Product.find($1)
@product =[:product])
raise "Invalid" unless @product.valid?