Skip to content

Instantly share code, notes, and snippets.

@EvanWillms
EvanWillms / ionic2-app.ts
Created July 7, 2016 04:09
Ionic2 Pushwoosh app.ts sample
import {Componente} from '@angular/core';
import {Platform, ionicBootstrap} from 'ionic-angular';
import {PushwooshService} from './services/pushwoosh.service';
@Component({
template: '<ion-nav [root]="rootPage" #ionNav></ion-nav>',
})
export class MyApp {
constructor(private platform:Platform,
@EvanWillms
EvanWillms / ionic2-pushwoosh.service.ts
Created July 7, 2016 04:04
Ionic2 Pushwoosh Integration
import {Injectable} from "@angular/core";
import {Device} from 'ionic-native';
declare var cordova : any;
var PUSHWOOSH_APP_ID = 'XXXXX-XXXXX';
var GOOGLE_PROJECT_NUMBER = 'XXXXXXXXXXXXX';
// For iOS, open your project .pList file in xCode and add:
// 1) "Pushwoosh_APPID" key with the Pushwoosh App Id value
@EvanWillms
EvanWillms / app.ts
Created April 10, 2016 19:45
Allow Ionic2 keyboard to open without pushing or scrolling content
// Minimum viable app.ts pulled from https://github.com/driftyco/ionic2-starter-blank/tree/41b4da8329636a95ab05d2579efd3a1527d2e830
// This snapshot is likely ionic-angular@2.0.0-beta.4 compatable
import 'es6-shim';
import {App, Platform} from 'ionic-angular';
import {StatusBar} from 'ionic-native';
import {HomePage} from './pages/home/home';
@App({
template: '<ion-nav [root]="rootPage"></ion-nav>',
@EvanWillms
EvanWillms / load_analytics.js
Last active August 29, 2015 14:03
segmentio/analytics.js open source script load
// Create a queue, but don't obliterate an existing one!
window.analytics = window.analytics || [];
// A list of the methods in Analytics.js to stub.
window.analytics.methods = ['identify', 'group', 'track',
'page', 'pageview', 'alias', 'ready', 'on', 'once', 'off',
'trackLink', 'trackForm', 'trackClick', 'trackSubmit'];
// Define a factory to create stubs. These are placeholders
// for methods in Analytics.js so that you never have to wait
@EvanWillms
EvanWillms / ga-with-unbounce-variant.js
Last active February 5, 2018 21:52
Track each Unbounce landing page variant in Google Analytics separately
<script type="text/javascript">
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
}
return null;
@EvanWillms
EvanWillms / replace_text_with_url_param.js
Created May 8, 2012 23:58 — forked from cgilchrist/replace_text_with_url_param.js
Replace some text on your page with the value of a URL parameter
<script type="text/javascript">
var getUrlParams = function() {
var params = {}, hash;
var hashes = decodeURI(window.location.href).replace(/\+/g," ").slice(window.location.href.indexOf('?') + 1).split('&');
for (var i=0; i<hashes.length; i++) {
hash = hashes[i].split('=');
params[hash[0]] = hash[1];
}
return params;
};
@EvanWillms
EvanWillms / ubuntu-11.10-gems.erb
Created March 13, 2012 22:25 — forked from kashif/ubuntu-11.10-gems.erb
Chef bootstrap With rvm and ruby 1.9.3 on ubuntu 11.10
bash -c '
<% if knife_config[:bootstrap_proxy] -%>
(
cat <<'EOP'
<%= "proxy = #{knife_config[:bootstrap_proxy]}" %>
EOP
) > ~/.curlrc
<% end -%>
if [ ! -f /usr/bin/chef-client ]; then