Skip to content

Instantly share code, notes, and snippets.

@josephwegner
josephwegner / confirmButton.js
Created December 15, 2012 01:53
AngularJS Bootstrap Popover Confirm Button Directive
var app = angular.module('TestApp', ['ui']).directive("confirmButton", function($document, $parse) {
});
function TestCtrl($scope) {
}
@josephwegner
josephwegner / rickRoll.js
Last active December 18, 2015 04:08
Rick Roll if there are too many entities
var rickrollDebugger = setInterval(function() {
if($(".entity").length > 50) {
window.open("http://www.youtube.com/watch?v=dQw4w9WgXcQ");
} else {
console.log($(".entity").length);
}
}, 20000);
lessonnote_dev=# UPDATE users SET admin='t' AND superadmin='t' WHERE id=1;
UPDATE 1
lessonnote_dev=# SELECT id, email, admin, superadmin FROM users WHERE id=1;
id | email | admin | superadmin
----+-------------------+-------+------------
1 | [email protected] | f | f
(1 row)
<span class="medium red">Up and Running In</span>
<span class="large white">90 Days</span>
<span class="medium red wtf-is-with-this-letter-spacing">Or Less</span>
@josephwegner
josephwegner / royal-crowne.md
Created June 24, 2013 00:40
Thank you, Royal Crowne Plaza

Dear Crowne Plaza,

I stayed over the weekend at the Royal Crowne Plaza in St. Louis, MO downtown. To say the least, the experience was horrible.

For reference, the reason for my staying in St. Louis was for a family wedding. The entire family - which should have totaled near 40 people - booked rooms in the hotel at a block rate. These reservations were made months in advance, and went relatively smoothly. As far as anyone was concerned, we were headed to a great celebratory weekend.

Me and my wife were actually coming a day late because I had to work, so the majority of the family arrived on Friday. We were monitoring the family's facebook activity to keep tabs on all the fun they were having, and the first update we saw was this:

"Worst stay ever...and we aren't even in our room. After three hours in the lobby we have made friends with the other 100 people that are waiting to check in."

javascript:(function()%7Bvar%20jqLoader%3D%7Bgo:function()%7Bif(!(window.jQuery%26%26window.jQuery.fn.jquery%3D%3D%271.4.4%27))%7Bvar%20s%3Ddocument.createElement(%27script%27)%3Bs.setAttribute(%27src%27,%27http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js%27)%3Bs.setAttribute(%27type%27,%27text/javascript%27)%3Bdocument.getElementsByTagName(%27head%27)%5B0%5D.appendChild(s)%7Dthis.ok()%7D,ok:function()%7Bif(typeof(window.jQuery)!%3D%3D%27undefined%27%26%26window.jQuery.fn.jquery%3D%3D%271.4.4%27)%7Bthis.init()%7Delse%7BsetTimeout((function()%7BjqLoader.ok()%7D),100)%7D%7D,init:function()%7B%24.getScript(%27http://www.badlydrawntoy.com/static/960grid/js/jquery.960grid.bk-1.2.min.js%27,function()%7B%24(%27body%27).addGrid(12)%7D)%7D%7D%3BjqLoader.go()%7D)()%3B
@josephwegner
josephwegner / lessonnote-deploy.sh
Created June 24, 2013 20:25
Deploy lessonnote to heroku with migrations
[check if `heroku` is installed]
# Note, that for production, you're going to need to find+replace lessonnote-staging to lessonnote-production
heroku maintenance:on --app lessonnote-staging
# Nato: The output of
# git tags
# will look like this:
#
# 1.0
@josephwegner
josephwegner / calendar.coffee
Created July 29, 2013 17:17
An AngularJS Calendar Directive that supports events and date-choosing
PlanApp.directive 'calendar', ($compile) ->
restrict: 'E'
templateUrl: "/assets/templates/calendar.html"
scope:
events: "=events"
currentEvent: "=event"
controller: ($scope, $element, $attrs, $transclude) ->
days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
$scope.months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
@josephwegner
josephwegner / api.coffee
Created August 1, 2013 13:40
AngularJS API Service
PlanApp.factory 'api', ($http) ->
###
# Factory for handling api resources
###
class APIBuilder
url: "#{window.location.protocol}//#{window.location.host}/api/v0/"
registerModel: (name, extensions) =>
if @[name]?
# Schedule Controller
PlanApp.controller "ScheduleCtrl", ($scope, api, $filter) ->
$scope.page = "schedule"
deals = []
stages = []
api.stages.getAll (err, data) ->
if err