Skip to content

Instantly share code, notes, and snippets.

@monnoval
monnoval / adddomain.rb
Last active August 29, 2015 13:58
Middleman - Add domain after build, can also be used as a search and replace after build
class AddDomain
def initialize(app, options={})
@app = app
@options = options
end
def call(env)
status, headers, response = @app.call(env)
if env['PATH_INFO'].end_with?('.html')
@monnoval
monnoval / _links.haml
Last active August 29, 2015 14:01
Middleman - Append partial in page via javascript
@monnoval
monnoval / _carousel.haml
Last active August 29, 2015 14:01
Middleman - Generate bootstrap carousel via content in YAML file
@monnoval
monnoval / _no-cache.haml
Created May 15, 2014 15:26
Prevent browser cache code for Middleman
/ Prevent browser cache
%meta{:content => "max-age=0", :http => {:equiv => "cache-control"}}
%meta{:content => "no-cache", :http => {:equiv => "cache-control"}}
%meta{:content => "0", :http => {:equiv => "expires"}}
%meta{:content => "Tue, 01 Jan 1980 1:00:00 GMT", :http => {:equiv => "expires"}}
%meta{:content => "no-cache", :http => {:equiv => "pragma"}}
@monnoval
monnoval / gist:3d1430c1a9d710105676
Created June 2, 2014 09:10
Count files in a directory using the command line
ls -R | grep .html$ | wc -l
@monnoval
monnoval / Default (Windows).sublime-keymap
Created July 25, 2014 10:20
Sublime Text Custom Keybindings
[
// BASIC COMMANDS
//
// `;;` to acts same as escape key
{ "keys": [";", ";"], "command": "exit_insert_mode",
"context":
[
{ "key": "setting.command_mode", "operand": false },
{ "key": "setting.is_widget", "operand": false }
]
// Project configuration
var project = 'bare'
, build = './build/'
, dist = './dist/'
, source = './src/' // 'source' instead of 'src' to avoid confusion with gulp.src
, lang = 'languages/'
, fonts = 'fonts/'
, bower = './bower_components/'
;
@monnoval
monnoval / install-bare.sh
Last active August 29, 2015 14:13
Bash script to install Bare Theme
#! /bin/bash
echo -n "Name of your theme: "
read -e THEME
git clone --depth=1 git@git.fastbooking.ch:msnoval/bare.git $THEME
cd ${THEME}
rm -rf .git
ack-grep -l --print0 "'bare'" | xargs -0 -n 1 sed -i -e 's/'\''bare'\''/'\'''$THEME''\''/g'
ack-grep -l --print0 'bare_' | xargs -0 -n 1 sed -i -e 's/bare_/'${THEME//-/_}'_/g'
ack-grep -l --print0 'Text Domain: bare' ./ | xargs -0 -n 1 sed -i -e 's/Text Domain: bare/Text Domain: '$THEME'/g'
@monnoval
monnoval / hf-group-import.json
Last active August 29, 2015 14:14
HF Group - Import setting for Pods
{"meta":{"version":"2.5.1.2","build":1430294294},"pods":{"4":{"id":4,"name":"hotel_brand","label":"Brand","description":"","type":"taxonomy","storage":"none","object":"","alias":"","fields":[],"show_in_menu":"1","label_singular":"Brand","public":"1","show_ui":"1","hierarchical":"1","rewrite":"1","rewrite_with_front":"1","rewrite_hierarchical":"1","menu_location":"default","menu_position":"0","show_in_nav_menus":"1","show_tagcloud":"1","show_admin_column":"1","menu_name":"Brands","built_in_post_types_hotel":"1","built_in_post_types_news":"0"},"5":{"id":5,"name":"city","label":"Cities","description":"","type":"post_type","storage":"meta","object":"","alias":"","fields":{"city_hotel":{"id":6,"name":"city_hotel","label":"Hotel","description":"","help":"","class":"","type":"pick","weight":0,"pick_object":"post_type","pick_val":"hotel","sister_id":"11","required":"0","pick_format_type":"multi","pick_format_single":"dropdown","pick_format_multi":"autocomplete","pick_taggable":"0","pick_limit":"0","pick_allow_html":"
@monnoval
monnoval / hf-solo-import.json
Last active August 29, 2015 14:14
HF Group - Import setting for Pods
{"meta":{"version":"2.5.1.2","build":1430294249},"pods":{"5":{"id":5,"name":"news_category","label":"Category","description":"","type":"taxonomy","storage":"none","object":"","alias":"","fields":[],"show_in_menu":"1","label_singular":"Category","public":"1","show_ui":"1","hierarchical":"1","rewrite":"1","rewrite_with_front":"1","rewrite_hierarchical":"1","built_in_post_types_news":"1","menu_name":"Categories","menu_location":"default","menu_position":"0","show_in_nav_menus":"1","show_tagcloud":"1","show_admin_column":"1","label_all_items":"All Categories","label_search_items":"Search Categories","label_popular_items":"Popular Category","label_separate_items_with_commas":"Separate category with commas","label_add_or_remove_items":"Add or remove category"},"6":{"id":6,"name":"facility","label":"Facilities","description":"","type":"post_type","storage":"meta","object":"","alias":"","fields":[],"show_in_menu":"1","label_singular":"Facility","public":"1","show_ui":"1","supports_title":"1","publicly_queryable":"1",