Skip to content

Instantly share code, notes, and snippets.

View johnnymo87's full-sized avatar

Jonathan Mohrbacher johnnymo87

View GitHub Profile
@johnnymo87
johnnymo87 / gist:1becb9c35216fa891b04d7f567bf34ad
Created July 27, 2016 00:29
SQL Server on Mac via virtualization
SQL Server on Mac via virtualization
Goal: I want to be able to spin up generic instances of sql server on-demand
Assumptions:
* [Windows Server 2016 Technical Preview (Core) is installed on virtualbox](http://ezeeetm.github.io/Docker-Engine-for-Windows-Server-Walkthrough/)
* Typical defaults: 4096MB RAM, 32 GB fixed space
* The image name is "sql server"
* The network is "bridged adapter"
* Guest additions are installed via `D:\VBoxWindowsAdditions.exe`
module ExercisesSpec where
import Test.Hspec
import Test.QuickCheck
import Control.Exception (evaluate)
import Exercises
main :: IO ()
main = hspec $ do
require 'spec_helper'
describe 'WITH RECURSIVE' do
# http://www.postgresql.org/docs/8.4/static/queries-with.html
# http://www.cybertec.at/common-mistakes-union-vs-union-all/
def query(n)
ActiveRecord::Base.connection.exec_query(
<<-SQL
M-D to D-M
:%s:\(\d\{1,2}/\)\(\d\{1,2}/\):\2\1:g
Discard all but the last 4 digits
::%s:\v.*(\d{4}):\1:g
@johnnymo87
johnnymo87 / gist:98388c9bc295bbb953ca
Created November 15, 2014 18:35
RSpec 2.99 deprecation warnings
Deprecation Warnings: [35/1389]
Use of rspec-core's `its` method is deprecated. Use the rspec-its gem instead. Called from /Users/johnnymo87/ruby/LocalSupport/spec/mailers/admin_mailer_spec.rb:6:in `block in <top (required)>'.
Use of rspec-core's `its` method is deprecated. Use the rspec-its gem instead. Called from /Users/johnnymo87/ruby/LocalSupport/spec/mailers/admin_mailer_spec.rb:7:in `block in <top (required)>'.
Use of rspec-core's `its` method is deprecated. Use the rspec-its gem instead. Called from /Users/johnnymo87/ruby/LocalSupport/spec/mailers/admin_mailer_spec.rb:8:in `block in <top (required)>'.
Too many uses of deprecated 'Use of rspec-core's `its` method'. Pass `--deprecation-out` or set `config.deprecation_stream` to a file for full output.
`and_return` on a negative message expectation is deprecated. Called from /Users/
@johnnymo87
johnnymo87 / gist:4771101448d2849af3f4
Last active August 29, 2015 14:07
Function.prototype.bind
// without Function.prototype.bind
window.user = {
data: [
{name:"T. Woods", age:37},
{name:"P. Mickelson", age:43}
],
clickHandler:function(obj) {
return function(e) {
e.preventDefault();
var randomNum = ((Math.random() * 2 | 0) + 1) - 1;
class TwitterFetcher
include Sidekiq::Worker
include Sidetiq::Schedulable
recurrence { minutely(5) }
def perform
# your main method here
end
end
@johnnymo87
johnnymo87 / gist:fba71b4371fa9057c7fb
Last active August 29, 2015 14:02
js letter shifter
var str = 'argentina';
for(var i = 0; i < str.length; i++) {
if (str[i].match(/[a-y]/i)) {
console.log(String.fromCharCode(str[i].charCodeAt(0) + 1))
} else if (str[i] === 'z') {
console.log('a')
};
};
@johnnymo87
johnnymo87 / sort.js
Last active August 29, 2015 14:02
Table sorting from scratch (with Zepto)
// Uses Zepto (http://zeptojs.com/)
$().ready(function() {
var order = new (function() {
var __front = 1,
__back = -1;
this.front = function() { return __front };
this.back = function() { return __back };
this.switch = function() {
__front = -__front;
@johnnymo87
johnnymo87 / users_controller.rb
Created May 27, 2014 02:52
Proposal for UsersController
# from the discussion here: https://github.com/AgileVentures/WebsiteOne/pull/417/files#discussion_r13060679
class UsersController < ApplicationController
include Youtube
# other methods elided
def show
@user = User.friendly.find(params[:id])
@user.extend Foo