This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
!function(){var Attribution=window.Attribution=window.Attribution||[];if(!Attribution.initialize)if(Attribution.invoked)window.console&&console.error&&console.error("Attribution snippet included twice.");else{Attribution.invoked=!0,Attribution.methods=["setAnonymousId","trackSubmit","trackClick","initialize","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","once","off","on"],Attribution.factory=function(e){return function(){var t=Array.prototype.slice.call(arguments);return t.unshift(e),Attribution.push(t),Attribution}};for(var t=0;t<Attribution.methods.length;t++){var e=Attribution.methods[t];Attribution[e]=Attribution.factory(e)}Attribution.load=function(t,e){var i=document.createElement("script");i.type="text/javascript",i.async=!0,i.src="https://scripts.attributionapp.com/v2/attribution.js";var r=document.getElementsByTagName("script")[0];r.parentNode.insertBefore(i,r),e=e||{},e.projectId=t,Attribution._loadOptions=e},At |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
window.Attribution=window.Attribution||[];window.Attribution.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","group","track","ready","alias","page","once","off","on"];window.Attribution.factory=function(e){return function(){var t=Array.prototype.slice.call(arguments);t.unshift(e);window.Attribution.push(t);return window.Attribution}};for(var i=0;i<window.Attribution.methods.length;i++){var key=window.Attribution.methods[i];window.Attribution[key]=window.Attribution.factory(key)}window.Attribution.load=function(e){if(document.getElementById("attribution-js"))return;var t=document.createElement("script");t.type="text/javascript";t.id="attribution-js";t.async=true;t.src="//scripts.attributionapp.com/attribution.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(t,n)};window.Attribution.load(); | |
window.Attribution.projectId="YOUR_PROJECT_ID"; | |
window.Attribution.page(window.ub && window.ub.page && window.ub.page.nam |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT | |
INTO | |
"staging_visits_2039" | |
SELECT | |
"events_stage_2039"."id", | |
"events_stage_2039"."visitor_id", | |
"events_stage_2039"."time" AS "visit_time", | |
(CASE "value" | |
WHEN '6154970940111' THEN 177765 | |
WHEN '6154852349911' THEN 177740 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Attribution snippet code | |
window.Attribution=window.Attribution||[];window.Attribution.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","group","track","ready","alias","page","once","off","on"];window.Attribution.factory=function(e){return function(){var t=Array.prototype.slice.call(arguments);t.unshift(e);window.Attribution.push(t);return window.Attribution}};for(var i=0;i<window.Attribution.methods.length;i++){var key=window.Attribution.methods[i];window.Attribution[key]=window.Attribution.factory(key)}window.Attribution.load=function(e){if(document.getElementById("attribution-js"))return;var t=document.createElement("script");t.type="text/javascript";t.id="attribution-js";t.async=true;t.src="//scripts.attributionapp.com/attribution.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(t,n)};window.Attribution.load(); | |
// set your project key | |
window.Attribution.projectId="YOUR_APP_KEY"; | |
// cross-domain hook | |
Attribution.ready(function() { | |
// list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('AttributionApp').run(['$rootScope', 'AnalyticsTracker', '$state', function($rootScope, AnalyticsTracker, $state) { | |
$rootScope.$on('$stateChangeSuccess', function(event, toState, toParams, fromState, fromParams) { | |
var toStateFragment = $state.href(toState, toParams); | |
var fromStateFragment = $state.href(fromState, fromParams); | |
var origin = window.location.origin; | |
var path = window.location.pathname; | |
// strip hash-bang from url | |
var pathWithParams = path + toStateFragment.replace(/^#!\//, '') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Application | |
module Controllers | |
class MyController < Sinatra::Base | |
helpers Sinatra::Streaming | |
class << self | |
def stream(method, path, opts = {}, &block) | |
send(method, path, opts) do | |
stream do |out| | |
timer = EventMachine::PeriodicTimer.new(10) { out << "\0" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# automatically spin off additional services in dev mode when `rails s` started | |
if Rails.env.development? && defined?(Rails::Server) | |
puts '=> Development mode server detected, spin off additional services' | |
Thread.new do | |
puts '=> Starting Delayed::Worker' | |
Delayed::Worker.new(:quiet => true).start | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Update rails from git on commits | |
# Author: Troex Nevelin <[email protected]> | |
cd /home/alex/smartspace_development | |
if [ -f .update_in_progress ]; then | |
exit 0 # exit if in progress or error happend | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Runner | |
@@nodes = {} | |
def self.node(site) | |
@@nodes[site] || = self.new_ar(site).new if !@@nodes.has_key?(site) | |
end | |
def self.new_ar(site) | |
Class.new(ActiveResource::Base) do | |
self.site = site |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# echo "11 5 * * * root /etc/backup-sql.sh | logger -t backup-sql" >> /etc/cron.d/backup | |
P="/var/www/sql_dump/" | |
MO="--skip-lock-tables" | |
MO="$MO --single-transaction" # for InnoDB | |
GZIP="gzip --rsyncable" | |
GZIP_ON_THE_FLY=true | |
SCOPE=`date +%u` # weekly rotation |
NewerOlder