Skip to content

Instantly share code, notes, and snippets.

View plusjade's full-sized avatar
🐵
🚀 🤖

Jade Dominguez plusjade

🐵
🚀 🤖
View GitHub Profile
@plusjade
plusjade / log.rb
Last active July 15, 2019 23:08
Custom rails logger
# place in ./config/initializers
# Usage
# LL.warn "blah"
# LL.warn @profile.inspect
require 'pp'
require 'log4r'
require 'log4r/configurator'
require 'log4r/yamlconfigurator'
require 'log4r/outputter/fileoutputter'
@plusjade
plusjade / github.rb
Created September 23, 2013 06:41
GitHub Pages publishing strategy for ruhoh v2.5
require 'tmpdir'
# Usage:
# add to ruhoh-site/plugins/publish/github.rb
# - Your GitHub remote must be setup properly but The command will try to walk you through it.
# - You must have a clean working directory to publish to GitHub pages since the hook is actually triggered by commits.
#
# $ cd ruhoh-site
# $ bundle exec ruhoh publish github
class Ruhoh
// array style, just list the damned questions!
var questions = [
{
question: "What color is Pikachu?",
answers: ["Light Blue", "Brown", "Yellow", "Green"],
solution: "Yellow"
}
,
{
question: "What color is Squirtle?",
@plusjade
plusjade / companies.csv
Created February 14, 2013 01:47
csv company dump
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 4.
Yamsafer, "Yamsafer brings the best, fastest & easiest hotel and event online booking experience to the Middle East by offering users innovative shopping experiences at unprecedented prices."
Warby Parker, "Warby Parker was founded with a rebellious spirit and a lofty objective: to create boutique-quality, classically crafted eyewear at a revolutionary price point."
VideoBlocks.com, "Video Blocks is the first subscription-based provider of stock video and audio, providing its members with unlimited download access to a vast, and growing, library of content. VideoBlocks.com offers unlimited access to over 50,000 clips of stock video, motion backgrounds, production music, editing templates, sound effects, special effects and more—all for the price of just one download at many competing sites. Customers range from leading television and movie production networks to pro-sumers and hobbyists looking to enhance their video projects and productions. "
Bigcommerce, "BigCommerce makes it easy to setup your own profess
@plusjade
plusjade / pages_filter.rb
Created November 30, 2013 11:12
Ruhoh plugin to pragmatically filter pages in a pages collection by an arbitrary prefix. Useful for filtering into sub-directories of the pages collection.
# ./my-blog/plugins/pages_filter.rb
module PagesFilter
# Filter pages by custom prefix.
# The prefix string is compared against the id which is the relative filepath.
# This enables sub-directory filtering.
# Example:
# <ul>
# {{# docs.filter.2/widgets/ }}
# <li>{{ title }}</li>
<div style="background-color:#333">Hello!</div>
@plusjade
plusjade / pages_random.rb
Last active December 23, 2015 08:09
Ruhoh plugin to pragmatically get a list of n random pages from an arbitrary pages collection.
# ./my-blog/plugins/pages_random.rb
module PagesRandom
# Return n random page objects.
# Limit can be set in config.yml:
# pages:
# random_limit: 10
def random
limit = config['random_limit'].to_i
limit = limit > 0 ? limit : 5
@plusjade
plusjade / folder_tree.rb
Last active December 23, 2015 07:59
Mustache block helper to quickly build folder tree heirarchies in HTML. The output uses nested unordered HTML lists. Example: http://ruhoh.com/docs/2/javascripts/ Usage: Place this in "./my-site/plugins/folder_tree.rb" then reload your web-server session. See inline documentation for syntax.
module FolderTree
# Mustache block helper to quickly build folder tree heirarchies in HTML.
# The output uses nested unordered HTML lists.
#
# Usage:
# {{# folder_tree }}
# pages
# about.md
# posts
# essays
{
"login": "plusjade",
"data": {
"version": "2",
"market-value": {
"score": 3.04,
"confidence": 0.6,
"explain": [
{
"name": "CompaniesRank",
@plusjade
plusjade / config.yml
Created September 8, 2013 18:54
Sample http://ruhoh.com configuration file.
---
# Usage: http://ruhoh.com
# This helps parsers (and hosting platforms) determine which version is needed to compile your site.
# If you compile your blog yourself, setting this won't matter, but it's a nice thing to keep updated.
RuhohSpec: "2.1"
# Used for things like RSS that need the full URL to a given resource.
# This DOES NOT affect any of your paths or links in any way.
# This DOES NOT configure domain mapping. See post2.ruhoh.com for hosting options.