Skip to content

Instantly share code, notes, and snippets.

View plcstevens's full-sized avatar

Philip Stevens plcstevens

View GitHub Profile

Comufyrails

This gem allows Ruby on Rails projects to connect with the Comufy service. It uses asynchronous calls and separate rake tasks to communicate with the Comufy API, allowing you to create, update your list of users as well as registering new tags and send messages to your users.

Installation

Add any of the lines to your application's Gemfile:

require 'comufy'
connect = Comufy.connect(access_token: ENV["COMUFY_ACCESS_TOKEN"], expiry_token: Time.now.to_i + 1000000)
# or use a yaml file
# connect = Comufy.connect(yaml: "path/to/yaml/file")
# lets add a user to our facebook application!
# http://graph.facebook.com/THEIR_NAME will get you back their id
# tags are the data fields to enter for this user.
app_name = "NAME_OF_YOUR_APPLICATION"

Comufy is an add-on for providing a programmer friendly API for connecting Heroku applications with the Comufy Social Suite.

The Comufy Social Suite delivers direct, personalised notifications at scale, with relevant content, targeted by user profile and behaviour, with complete attribution of results.

By adding Comufy to your application you will have the Comufy Service Suite available and functional at almost no development costs. The Comufy addon provides the tools to push your collected data to Comufy's Service Suite, providing you with their excellent data analysis and targeted messaging to get the most out of your Facebook applications and users.

@plcstevens
plcstevens / gist:7560657
Last active December 28, 2015 20:49 — forked from lamp/gist:7543563
<script id="reevoomark-loader" type="text/javascript" charset="utf-8">
(function() {
var trkref = 'TRKREF';
var myscript = document.createElement('script');
myscript.type = 'text/javascript';
var protocol = (window.location.protocol == 'https:')? window.location.protocol : 'http:';
myscript.src=(protocol + '//mark.reevoo.com/reevoomark/'+trkref+'.js?async=true');
var s = document.getElementById('reevoomark-loader');
s.parentNode.insertBefore(myscript, s);
})();
@plcstevens
plcstevens / gist:8238561
Last active January 2, 2016 02:39 — forked from lamp/gist:7769533
(function() {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'http://cdn.mark.reevoo.com/assets/reevoo_mark.js';
var s = document.getElementById('reevoomark-loader');
s.parentNode.insertBefore(script, s);
})();
afterReevooMarkLoaded = [function(){
ReevooApi.load('YOUR_TRKREF_HERE', function(retailer){
function callReevoo(cat, act, sku, url) {
ReevooMark.Tracking.ga_track_event(cat, act, sku);
ReevooMark.track_exit();
setTimeout(function(){ window.location=url; }, 500);
return false;
}
@plcstevens
plcstevens / no_pre_compile.rb
Last active August 29, 2015 14:06
Only pre-compile when necessary
# set the locations that we will look for changed assets to determine whether to precompile
set :assets_dependencies, %w(app/assets lib/assets vendor/assets Gemfile.lock config/routes.rb)
# clear the previous precompile task
Rake::Task["deploy:assets:precompile"].clear_actions
class PrecompileRequired < StandardError; end
namespace :deploy do
namespace :assets do
desc "Precompile assets"
@plcstevens
plcstevens / reevoomark2.js
Last active August 29, 2015 14:06
Possible implementation technique for future JavaScipt library. This would avoid issues with asynchronous vs synchronous method calls and also allow for a very verbose API that would be easily extendable.
(function(url, name){
(window.ReevooMarkObjects = window.ReevooMarkObjects || []).concat([name]);
window[name] = window[name] || function(){
(window[name].queue = window[name].queue || []).push([arguments]);
};
var script = document.createElement("script");
script.async = true;
script.src = url;
@plcstevens
plcstevens / reevoomark_observing.js
Last active April 6, 2016 10:44
This is how a client can implement their own callbacks onto our badge actions.
(function() {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'http://cdn.mark.reevoo.com/assets/reevoo_mark.js';
var s = document.getElementById('reevoomark-loader');
s.parentNode.insertBefore(script, s);
})();
afterReevooMarkLoaded = [function(){
ReevooApi.load('YOUR_TRKREF', function(retailer){
@plcstevens
plcstevens / reevoomark_defined.js
Last active August 29, 2015 14:06
This is how we can allow users to call ReevooMark api actions from outside of our callbacks. Please note as this is all asynchronous, ReevooMark is not guaranteed to exist. Therefore this should only be used when the call to ReevooMark occurs some time after page load.
(function() {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = '//cdn.mark.reevoo.com/assets/reevoo_mark.js';
var s = document.getElementById('reevoomark-loader');
s.parentNode.insertBefore(script, s);
})();
afterReevooMarkLoaded = [function() {
ReevooApi.load('YOUR_TRKREF', function(retailer) {