Skip to content

Instantly share code, notes, and snippets.

Avatar
🐵
🚀 🤖

Jade Dominguez plusjade

🐵
🚀 🤖
View GitHub Profile
@plusjade
plusjade / mathjax.rb
Created May 15, 2012
ruhoh plugin to overload the redcarpet parser with mathjax tags
View mathjax.rb
# place mathjax.rb in _plugins directory of your blog
require 'redcarpet'
class HTMLwithAlbino < Redcarpet::Render::HTML
def block_code(code, language)
if language == 'mathjax'
"<script type=\"math/tex; mode=display\">
#{code}
</script>"
else
"<pre><code class=\"#{language}\">#{code}</code></pre>"
@plusjade
plusjade / mustache_limits.rb
Created May 15, 2012
Sample ruhoh plugin to extend mustache with "posts_limit_n" block helpers
View mustache_limits.rb
# Sample ruhoh plugin to extend mustache with "posts_limit_n" block helpers
# See sample.html for sample usage.
# Installation: place this ruby file in the _plugins directory in the root of your blog.
class Ruhoh
module Templaters
module Helpers
LimitRegex = /^(\w+)_limit_(\d+)/
def limit_to(method, limit)
View feed.rss
<?xml version="1.0"?>
<rss version="2.0">
<channel>
<title>Blog Title</title>
<link>http://sample.com</link>
<pubDate>2012-05-30 02:23:25 -0700</pubDate>
<item>
<title>Oh Happy Day Part Two</title>
<link>http://sample.com/oh-happy-day-part-two</link>
<pubDate>2012-05-30</pubDate>
@plusjade
plusjade / Rakefile
Created Jun 5, 2012
rake task for upgrading your ruhoh blog from v0.3.0 to v1.0.0-alpha
View Rakefile
require 'rubygems'
require 'ruhoh'
require 'yaml'
# ruhoh Upgrade Script
# ruhoh gem upgrade from 0.3.0 to 1.0.0-alpha
# ruhohSpec upgrade from 0.2 to 1.0
#
# How to Use:
# Create a file named 'Rakefile' in the root of your blog directory and place the full contents of this gist inside.
@plusjade
plusjade / layout.html
Created Jul 21, 2012
lightbox.js customization for pragmatically setting options and initializing
View layout.html
<!--
In lightbox.js you need to remove the initialization function call at the bottom.
Lines highlighted here: https://github.com/lokesh/lightbox2/blob/master/js/lightbox.js#L345-349
This is what "starts" lightbox.
Place the initialization function at the bottom of one of your html layouts like so:
-->
<script>
$(function() {
View kramdown_converter.rb
class Ruhoh
module Converter
module Markdown
def self.extensions
['.md', '.markdown']
end
def self.convert(content)
require 'kramdown'
Kramdown::Document.new(content).to_html
end
@plusjade
plusjade / companies.csv
Created Feb 14, 2013
csv company dump
View companies.csv
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 / keyword-boosting
Created Feb 19, 2013
Elasticsearch curl example for ranking by individual token boosts. You can copy this full input and paste it directly into the command-line. Expected results: The result set should be sorted perfectly by the boost value for the skill "ruby". Please note term-frequencies WILL affect scoring and it's only because these documents have the exact sam…
View keyword-boosting
curl -XDELETE 'http://localhost:9200/p'
curl -XPOST 'http://localhost:9200/p'
curl -XPOST 'localhost:9200/p/profile/_mapping' -d '
{
"profile": {
"properties": {
"skills": {
"type": "string",
"omit_term_freq_and_positions" : true,
@plusjade
plusjade / random-view.html.haml
Created Apr 16, 2013
Simple example of rails javascript-in-views refactoring
View random-view.html.haml
#share-on-yammer-modal.modal.fade
.modal-header
... blah
- content_for :partial_javascripts do
:plain
Gild.profileView.shareOnYammer(#{ @profile.to_json });
@plusjade
plusjade / log.rb
Last active Jul 15, 2019
Custom rails logger
View log.rb
# 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'
You can’t perform that action at this time.