A Pen by Devon Greenway on CodePen.
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
DECLARE @StartDate date = '20100101'; | |
DECLARE @CutoffDate date = DATEADD(DAY, -1, DATEADD(YEAR, 30, @StartDate)); | |
;WITH seq(n) AS | |
( | |
SELECT 0 UNION ALL SELECT n + 1 FROM seq | |
WHERE n < DATEDIFF(DAY, @StartDate, @CutoffDate) | |
), | |
d(d) AS |
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
CREATE TABLE `calendar_table` ( | |
`dt` date NOT NULL, | |
`y` smallint(6) DEFAULT NULL, | |
`m` tinyint(4) DEFAULT NULL, | |
`d` tinyint(4) DEFAULT NULL, | |
`dw` tinyint(4) DEFAULT NULL, | |
`monthName` varchar(9) DEFAULT NULL, | |
`dayName` varchar(9) DEFAULT NULL, | |
`isWeekday` inary(1) DEFAULT NULL, | |
`isHoliday` binary(1) DEFAULT NULL, |
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
$ which mysqld | |
/usr/sbin/mysqld | |
$ /usr/sbin/mysqld --verbose --help | grep -A 1 "Default options" | |
Default options are read from the following files in the given order: | |
/etc/mysql/my.cnf ~/.my.cnf /usr/etc/my.cnf |
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
(function (ko, handlers, unwrap, extend) { | |
"use strict"; | |
extend(handlers, { | |
stopBubble: { | |
init: function(element) { | |
ko.utils.registerEventHandler(element, "click", function(event) { | |
event.stopPropagation(); | |
}); | |
} | |
}, |
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
// Example of creating a Name Spaced object in javascript inspired by: | |
// http://stackoverflow.com/questions/881515/how-do-i-declare-a-namespace-in-javascript | |
// Jaco Pretorius: http://stackoverflow.com/users/121531/jaco-pretorius | |
(function( skillet, $, undefined ) { | |
//Private Property | |
var isHot = true; | |
//Public Property | |
skillet.ingredient = "Bacon Strips"; |
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
mock = MiniTest::Mock.new | |
mock.expect(:call, true) | |
fa.stub(:the_thing, mock) do | |
fa.method_that_calls_the_thing | |
end | |
assert mock.verify |
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
describe 'tests the thing' | |
it 'tests the thing' do | |
foo = ClassUnderTest.new | |
# monkeypatch an attribute onto our class | |
class << foo | |
attr_accessor :the_thing_was_called | |
end | |
# redefine the the_thing method | |
def fa.the_thing | |
self.the_thing_was_called = true |
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
var pubsub = {}; | |
(function(q) { | |
var topics = {}, subUid = -1; | |
q.subscribe = function(topic, func) { | |
if (!topics[topic]) { | |
topics[topic] = []; | |
} | |
var token = (++subUid).toString(); | |
topics[topic].push({ | |
token: token, |
NewerOlder