Skip to content

Instantly share code, notes, and snippets.

@kitop
kitop / proxy.rb.diff
Created November 13, 2020 15:22
Mongoid public method issue
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
_target
end
+ def send(method, *args)
+ if respond_to?(method)
@kitop
kitop / repro.rb
Last active October 17, 2020 23:18
Mongo relationship issue
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'mongoid', '~> 7.1.4'
gem 'minitest', '~> 5.14.1', require: ['minitest', 'minitest/autorun']
end
class Parent
include Mongoid::Document
#!/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 =
"iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAAAXNSR0IArs4c6QAAAAlwSFlzAAAWJQAAFiUBSVIk8AAABBdpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iCiAgICAgICAgICAgIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIgogICAgICAgICAgICB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iCiAgICAgICAgICAgIHhtbG5zOnRpZmY9Imh0dHA6Ly9ucy5hZG9iZS5jb20vdGlmZi8xLjAvIj4KICAgICAgICAgPHhtcE1NOkRlcml2ZWRGcm9tIHJkZjpwYXJzZVR5cGU9IlJlc291cmNlIj4KICAgICAgICAgICAgPHN0UmVmOmluc3RhbmNlSUQ+eG1wLmlpZDpFQzNGNDNDODdCMkIxMUU5QkNENURBRDc2M0Q
@kitop
kitop / README.md
Last active February 16, 2018 11:33 — forked from pyreta/playlists.md
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
const Elm = require("../../elm/HelloWorld.elm")
window.registerApp({ HelloWorld: Elm.HelloWorld })
@kitop
kitop / script.sh
Created March 31, 2017 07:39
Template Bash Script
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
# Taken from https://dev.to/thiht/shell-scripts-matter
#/ Usage:
#/ Description:
#/ Examples:
#/ Options:
@kitop
kitop / requerimientos.md
Last active August 29, 2015 14:08
angular on cuba - Rubyconf 2014
@kitop
kitop / app.rb
Created April 11, 2014 22:40
nested routes
Cuba.define do
on "posts" do
run Posts
end
end
class Posts < Cuba
define do
on ":id" do |id|
post = Post[id]
@kitop
kitop / post-commit
Last active January 2, 2016 13:39
Git post commit hook to remind to precompile some assets
#!/bin/sh
#
# A hook script to remind us to precompile the assets.
color='\033[0;35m'
NC='\033[0m' # No Color
changes=$(git diff --name-only HEAD^)