Skip to content

Instantly share code, notes, and snippets.

View PlenipotentSS's full-sized avatar

Steven Stevenson PlenipotentSS

View GitHub Profile
@PlenipotentSS
PlenipotentSS / google_analytics_service.rb
Created November 3, 2016 18:13
Service class using ruby/rails and google api client >.9. This uses google analytics service account.
require 'google/apis/analytics_v3'
class GoogleAnalyticsService
def initialize
@filters = nil
@metrics = "ga:uniquePageviews"
@dimensions = 'ga:date'
end
@PlenipotentSS
PlenipotentSS / react-month-year.js.jsx
Last active June 18, 2016 06:26
Simple Month and Year React Component - formatted for rails backend
var MonthYear = React.createClass({
/**
* @return {hash of initial state}
*/
getInitialState() {
var month, year;
if (this.props.value) {
var d = new Date(this.props.value)
d.setHours(d.getHours()+15)
@PlenipotentSS
PlenipotentSS / simple_config_and_start_cluster.sh
Last active March 17, 2016 06:57
PG Travis Tools Simple PGVersion startup
#!/bin/bash
# continued from https://gist.github.com/jasonmp85/9963879
set -eux
# Create fully-trusting cluster on custom port, owned by us
sudo pg_createcluster $PGVERSION test -p 55435 -u `whoami` -- -A trust
@PlenipotentSS
PlenipotentSS / mixin.scss
Created April 7, 2015 18:57
SCSS fancy underline mixin
@mixin fancy-underline( $regColor:transparent, $hoverColor:#ffffff, $size: 1.5px, $distance: 4px, $delay: false) {
@include transition(padding .2s ease-in-out);
@if $delay {
@include transition-delay(.2s);
}
border-bottom: $size solid transparent;
color: $regColor;
display: inline-block;
text-decoration: none;
<div id="fb-root"></div><script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0];if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=543069402473732"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
<script type="text/javascript">(function() {var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/platform.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); })(); </script>
<script type="text/javascript">(function(d){var f = d.getElementsByTagName('SCRIPT')[0], p = d.createElement('SCRIPT'
@PlenipotentSS
PlenipotentSS / hammie.js
Last active August 29, 2015 14:17
Hammie JS
var $win, $doc,
$body = $('body'),
$main = $('main'),
$hammie = $('.hammie');
var toggleMobileMenu = function() {
if ($body.hasClass('is-active')) {
$mobileDrawer.animate({
height: 0
@PlenipotentSS
PlenipotentSS / hammie.scss
Last active August 29, 2015 14:17
Hammie SCSS
// mobile navigation icon
// using bourbon library
.hammie {
.has-universe & {
top: $universeBarHeight+45+px;
}
display: none;
vertical-align: middle;
<script>
var owl, cat, whowins, winner;
whowins= prompt("Guess who will the tootsie pop contest, Owl or Cat?");
function Animal(name, speed, focus){
this.name= name;
this.speed=speed;
this.position=0;
this.focus= focus;
this.run= function(){
if(Math.random() *10 < this.focus) {
<script>
var debug = false
var counter, openPile;
//NEED WELCOME/INTRO
//create class of cards
function Card(rank, suit) {
this.rank = rank;
this.suit = suit;
<script>
var feet, result, var tries;
var findDifference = function(answer, guess) {
if (answer > guess) {
return answer - guess;
}
else {
return guess-answer;
}
}