Skip to content

Instantly share code, notes, and snippets.

@did
did / Gemfile
Created November 26, 2014 00:08
Gemfile for windows
source 'https://rubygems.org'
gem 'locomotivecms_wagon', '1.5.1'
# group :development do
# Mac OS X
# gem 'rb-fsevent', '~> 0.9.1', require: RUBY_PLATFORM.include?('darwin') && 'rb-fsevent'
# Unix
# gem 'therubyracer', require: 'v8', platforms: :ruby unless RUBY_PLATFORM.include?('darwin')
# Human readable name of this type
name: Videos
# Lowercase, underscored handle used to access this type
slug: videos
# Explanatory text displayed in the back-office
description: A description of the content type for the editors
# Slug of field used to identify entries by default, such as the title
# Human readable name of this type
name: Courses
# Lowercase, underscored handle used to access this type
slug: courses
# Explanatory text displayed in the back-office
description: A description of the content type for the editors
# Slug of field used to identify entries by default, such as the title
@did
did / DMTrial.h
Created September 29, 2014 18:53
//
// DMTrial.h
// DevMateActivations
//
// Copyright (c) 2013-2014 MacPaw Inc. All rights reserved.
//
#ifndef __DevMateActivations__DMTrial__
#define __DevMateActivations__DMTrial__
@did
did / gist:ee2d29a6e48260d53f12
Last active August 29, 2015 14:06
devise.rb
# Use this hook to configure devise mailer, warden hooks and so forth. The first
# four configuration values can also be set straight in your models.
Devise.setup do |config|
# ==> Mailer Configuration
# Configure the e-mail address which will be shown in DeviseMailer.
config.mailer_sender = Settings.email
# Configure the class responsible to send e-mails.
config.mailer = 'Locomotive::DeviseMailer'
@did
did / gist:e686bfef86c78c4764e4
Created September 10, 2014 09:15
Instrumentation
def refresh_conflicts(dispatch)
unavailables = []
# 1. reset the unavailability of all the dispatched faces
_instrument 'dispatch_service.refresh_conflicts.reset' do
dispatch.faces.update_all(unavailable: false)
end
# 2. find the dispatched faces in conflict
dispatch.faces.each do |face|
@did
did / api.rb
Created July 21, 2014 13:59
LocomotiveCMS API Example
require 'httparty'
require 'locomotive/mounter'
$api_base_url = ""
$api_key = ""
Locomotive::Mounter::EngineApi.set_token(uri: "http://#{$api_base_url}/locomotive/api", api_key: api_key)
attributes = {
title: 'Hello world',
description: 'Lorem ipsum'
@did
did / adagp.rb
Created April 18, 2014 15:52
Timeout pour Wagon
#!/usr/bin/env ruby
#
# This file was generated by Bundler.
#
# The application 'builder' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../Gemfile",
@did
did / test.rb
Created October 25, 2013 12:53
Slim / Liquid
require 'slim'
template = %{
doctype html
head
body
{% for product in products %}
{{ product.name }}
{% endfor %}
}
@did
did / gist:6431083
Created September 3, 2013 23:44
[WIP] with_scope tag using Solid (needs to re-parse all the pages)
module Locomotive
module Liquid
module Tags
# Filter a collection
#
# Usage:
#
# {% with_scope main_developer: 'John Doe', active: true %}
# {% for project in contents.projects %}