most of these require logout/restart to take effect
# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false
# Set a shorter Delay until key repeat| 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, |
| 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 |
| mock = MiniTest::Mock.new | |
| mock.expect(:call, true) | |
| fa.stub(:the_thing, mock) do | |
| fa.method_that_calls_the_thing | |
| end | |
| assert mock.verify |
| // 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"; |
| (function (ko, handlers, unwrap, extend) { | |
| "use strict"; | |
| extend(handlers, { | |
| stopBubble: { | |
| init: function(element) { | |
| ko.utils.registerEventHandler(element, "click", function(event) { | |
| event.stopPropagation(); | |
| }); | |
| } | |
| }, |
| $ 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 |
A Pen by Devon Greenway on CodePen.
| 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, |
| 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 |