Skip to content

Instantly share code, notes, and snippets.

View easierbycode's full-sized avatar

▓▒░ ♔ Daniel ♔ ░▒▓ easierbycode

View GitHub Profile
@easierbycode
easierbycode / defineGetter.coffee
Last active December 18, 2015 07:29
defineGetter
Trip = (startTime) ->
@startTime = (if startTime? then startTime else new Date().getTime())
@__defineGetter__ "startInWords", ->
diff = (((new Date()).getTime() - (new Date(@startTime)).getTime()) / 1000)
dayDiff = Math.floor(diff / 86400)
dayDiff is 0 and (diff < 60 and "just now" or diff < 120 and "1 minute ago" or diff < 3600 and Math.floor(diff / 60) + " minutes ago" or diff < 7200 and "1 hour ago" or diff < 86400 and Math.floor(diff / 3600) + " hours ago") or dayDiff is 1 and "Yesterday" or dayDiff < 7 and dayDiff + " days ago" or Math.ceil(dayDiff / 7) + " weeks ago"
myTrip = new Trip()
tenDaysAgoTime = new Date().getTime() - ((86400 * 10) * 1000)
tenDaysAgoTrip = new Trip(tenDaysAgoTime)
class GlobalTranz
has_many :carriers, through: :preferred_network
has_many :opportunities
def initialize
@locations = [:az, :co]
@revenue = true
@competition = nil
end
class GlobalTranz
headquarters: 'AZ', revenue: true, industryLeader: true
delivers: ['insight', 'passion', 'innovative products']
logistics: ['technologySolutions', 'service', 'efficiency']
culture:
workHard:true
recognizedSuccess:true
careerAdvancement:true
facts:
benefits:true
@easierbycode
easierbycode / sudo
Created August 27, 2013 21:16
Nitrous.IO OS X 10.9 crash log
********** Bootstrapped Creating a default store:1 SpotLoc:(null) SpotVerLoc:(null) occlude:0 /Volumes/Nitrous.io
2013-08-27 13:08:41 -0700 mds[43]: (Warning) Volume: vsd:0x7fdc6c80fe00 Open failed. failureCount:0 (null)
2013-08-27 13:08:58 -0700 mds[43]: (Warning) Volume: vsd:0x7fdc6a89c400 Open failed. failureCount:1 {
DisabledRecycleCount = 1;
}
2013-08-27 13:09:30 -0700 mds[43]: (Warning) Volume: vsd:0x7fdc6a844800 Open failed. failureCount:2 {
DisabledRecycleCount = 2;
}
2013-08-27 13:10:30 -0700 mds[43]: (Warning) Volume: vsd:0x7fdc6d83d000 Open failed. failureCount:3 {
DisabledRecycleCount = 3;
@easierbycode
easierbycode / gist:6718984
Created September 26, 2013 19:01
json-generator for analytics
[
'{{repeat(10)}}',
{
name: "{{firstName}}'s Campaign",
start_date: '{{date(2013-10-ddThh:mm:ss Z)}}',
sent: '{{numeric(214,594)}}',
opened: '{{numeric(143,421)}}',
clicked: '{{numeric(8,32)}}',
visits: '{{numeric(4,23)}}',
revenues: '{{numeric(3049,9054,%=$0,0.00)}}'
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
<li class="topcoat-list__item" ng-repeat="alert in alerts | orderBy:'-updateTime'">
<span class='subtext'>{{ alert.updateTime | date:'MMM d h:mm a' }}</span> <b>{{ alert.type }} is {{ alert.measurement }} {{ alert.unit }}</b>
</li>
@easierbycode
easierbycode / app.js
Created November 21, 2013 21:53 — forked from auser/app.js
angular.module('myApp',
['ngRoute', 'myApp.services', 'myApp.directives']
)
.config(function(AWSServiceProvider) {
AWSServiceProvider.setArn('arn:aws:iam::<ACCOUNT_ID>:role/google-web-role');
})
.config(function(StripeServiceProvider) {
StripeServiceProvider.setPublishableKey('pk_test_YOURKEY');
})
.config(function($routeProvider) {
@easierbycode
easierbycode / index.js
Last active January 4, 2016 21:09 — forked from btford/friendlify
var friendlify = function (fn, log) {
var patsOnTheBack = [
'you are great',
'you\'re the best',
'wow you\'re awesome'
];
log = log || console.log;
return function () {
var args = arguments;
log(patsOnTheBack[Math.floor(patsOnTheBack.length * Math.random())] + '!');
@easierbycode
easierbycode / index.html
Last active August 29, 2015 14:00
1.0 doesn't mean stable
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="stylesheet" href="http://cmx.io/v/0.1/cmx.css">
<script src="http://cmx.io/v/0.1/cmx.js" charset="utf-8"></script>
<body>
<div style="max-width:900px; -webkit-transform:rotate(0deg)">
<scene id="scene1">
<drawing t="translate(0,31)">
<line stroke="green">