Skip to content

Instantly share code, notes, and snippets.

@meesterdude
meesterdude / gist:403319a079828497bff7c4f52e7451d3
Last active Apr 30, 2021
installing handlebars-helpers in ghost
View gist:403319a079828497bff7c4f52e7451d3
// installing handlebars-helpers for V3 of ghost platform (current as of version 3.37)
// in your ghost install directory, run `yarn add handlebars-helpers` to install the package
// in your project directory of versions/YOUR_VERSION/core/frontend/helpers/index.js
// change L4 to be
// const helpers = require('handlebars-helpers')();
// on production server, edit versions/YOUR_VERSION/node_modules/gscan/lib/spec.js
// remove the method body but keep the theme return value; without this change, themes using custom helpers will fail gscan
View test.js
function elementNamer(element)
{var name = element.nodeName + " class='" + element.className + "' id='" + element.id + "'"return name;};
@meesterdude
meesterdude / README.md
Last active Mar 23, 2017
emoji_spec is a microgem to put emoji in your rspec output.
View README.md

Emoji Spec

results Tired of the same, dull rspec output? liven it up with some emoji!

Below are the sets presently available, and their corresponding id. if you don't set an ID, one will be randomly chosen every run. Emoji icons may not render in certain terminals.

(pass, fail, pending)

emoji

View gist:5063477
[2013-03-01T10:21:52+01:00] INFO: Storing updated cookbooks/openssl/metadata.json in the cache.
[2013-03-01T10:22:02+01:00] INFO: Storing updated cookbooks/openssl/metadata.rb in the cache.
[2013-03-01T10:22:12+01:00] INFO: Storing updated cookbooks/openssl/README.md in the cache.
[2013-03-01T10:22:22+01:00] INFO: Storing updated cookbooks/iptables/recipes/chef.rb in the cache.
[2013-03-01T10:22:32+01:00] INFO: Storing updated cookbooks/iptables/recipes/default.rb in the cache.
[2013-03-01T10:22:42+01:00] INFO: Storing updated cookbooks/iptables/recipes/statsd.rb in the cache.
================================================================================
Error Syncing Cookbooks:
View gist:4982567
PS1="[\u@\h] \w\$(git branch 2> /dev/null | grep -e '\* ' | sed 's/^..\(.*\)/(\1)/')\$(git stash list 2> /dev/null | grep -e 'stash' | wc -l | sed 's/^ *//' | sed -n 's/\([1-9]\)/\{stashed:\1\}/p')\$ "
=> [ruru64@ruru64s-iMac] ~/adev/creativebug(master){stashed:1}$
or if no git..
=> [ruru64@ruru64s-iMac] ~/adev$
@meesterdude
meesterdude / _before.rb
Last active Dec 12, 2015
before and after comments. Note the changes in clarity and depth of understanding.
View _before.rb
require "semantic"
require "pp"
corpus = Semantic::Corpus.new([], :transforms => [:LSA])
Dir.glob("/tmp/some_texts/*.txt").each do |file|
corpus << Semantic::Document.new(open(file), :name => File.basename(file))
end
corpus.build_index
@meesterdude
meesterdude / gist:4380860
Created Dec 26, 2012
solr console output
View gist:4380860
[ruru64@ruru64s-iMac] ~/adev/creativebug(resend_gift)$ solr ~/adev/creativebug/solr/
2012-12-26 10:11:40.998:INFO:oejs.Server:jetty-8.1.2.v20120308
2012-12-26 10:11:41.013:INFO:oejdp.ScanningAppProvider:Deployment monitor /usr/local/Cellar/solr/4.0.0/libexec/example/contexts at interval 0
2012-12-26 10:11:41.017:INFO:oejd.DeploymentManager:Deployable added: /usr/local/Cellar/solr/4.0.0/libexec/example/contexts/solr.xml
2012-12-26 10:11:41.675:INFO:oejw.StandardDescriptorProcessor:NO JSP Support for /solr, did not find org.apache.jasper.servlet.JspServlet
2012-12-26 10:11:41.714:INFO:oejsh.ContextHandler:started o.e.j.w.WebAppContext{/solr,file:/usr/local/Cellar/solr/4.0.0/libexec/example/solr-webapp/webapp/},/usr/local/Cellar/solr/4.0.0/libexec/example/webapps/solr.war
2012-12-26 10:11:41.714:INFO:oejsh.ContextHandler:started o.e.j.w.WebAppContext{/solr,file:/usr/local/Cellar/solr/4.0.0/libexec/example/solr-webapp/webapp/},/usr/local/Cellar/solr/4.0.0/libexec/example/webapps/solr.war
Dec 26, 2012 10:11:41 AM
@meesterdude
meesterdude / simpler-rails.sublime-project
Created Dec 19, 2012
Sublime Text 2 Project file for day to day Ruby on Rails work.
View simpler-rails.sublime-project
{
"folders":
[
{
"path": "/",
"folder_exclude_patterns": [
"app/mailers",
"app/helpers",
"app/assets/images",
@meesterdude
meesterdude / image_finder.rb
Created Oct 1, 2012
Automatically fixes missing images by downloading from live site, if present.
View image_finder.rb
# check pages for missing images. if present on live site, pull down to same path.
# in app controller
def correct_missing_file
return unless Rails.env == 'development'
tpath = params[:file].split('?').first
fpath = tpath.split('/')
fpath.pop
fpath = fpath.join('/')
uri = URI('http://www.creativebug.com' + tpath)
View store_controller.rb
class StoreController < ApplicationController
before_filter :check_store_status, :except => :store_closed
before_filter :find_cart, :except => :store_closed
before_filter :confirm_cart_not_empty, :only => [:display_cart, :checkout, :confirm_order, :save_order]
layout 'store'
def checkout
unless @cart.all_items_purchasable?