Skip to content

Instantly share code, notes, and snippets.

View lokimeyburg's full-sized avatar
:shipit:
2022 resolution: learn Typescript and GraphQL

Loki Meyburg lokimeyburg

:shipit:
2022 resolution: learn Typescript and GraphQL
View GitHub Profile
@lokimeyburg
lokimeyburg / console
Created February 22, 2012 18:53
Replace Rails console with Pry
alternatively:
script/console --irb=pry
@lokimeyburg
lokimeyburg / rbenv.sublime-build
Created September 10, 2012 20:43
rbenv build system for Sublime Text 2
{
"cmd": ["/usr/local/bin/rbenv", "exec", "ruby", "$file"],
"selector": "source.ruby"
}
@lokimeyburg
lokimeyburg / msp_number_generator.rb
Created October 26, 2012 23:43
Generate your own valid Canadian Medical Services Plan number.
def valid_msp_number(msp_number)
weights = [0, 2, 4, 8, 5, 10, 9, 7, 3, 0]
total = 0
weights.to_enum.with_index(1).each do |weight, i|
total = total + msp_number[i-1].to_i * weight.to_i
end
a = total / 11
b = a * 11
c = total - b
result = 11 - c
@lokimeyburg
lokimeyburg / development.rb
Created October 29, 2012 18:36
Paperclip & Amazon S3
# environments/{development.rb || test.rb}
# Left blank to skip s3 in development.
PAPERCLIP_STORAGE_OPTIONS = {}
@lokimeyburg
lokimeyburg / closest_descendent.js
Last active December 16, 2015 08:49
$(element).closest_descendent('something') Similar to jquery .closest() but traversing decedents.
$.fn.closest_descendent = function(filter) {
var $found = $(),
$currentSet = this; // Current place
while ($currentSet.length) {
$found = $currentSet.filter(filter);
if ($found.length) break; // At least one match: break loop
// Get all children of the current set
$currentSet = $currentSet.children();
}
return $found.first(); // Return first match of the collection
@lokimeyburg
lokimeyburg / typewatch.js
Created October 9, 2013 14:54
typewatch.js "call a function after a user has stopped typing."
// a simple function to execute a callback,
// after the user has stopped typing for a specified amount of time
var typewatch = (function(){
var timer = 0;
return function(callback, ms){
clearTimeout (timer);
timer = setTimeout(callback, ms);
};
})();
@lokimeyburg
lokimeyburg / pubsub.js
Created March 7, 2014 19:06
Simple PubSub with Javascript
/*
## Simple PubSub with Javascript
### Usage:
var client = pubsub.subscribe('myChannel', function(data){
console.log(data);
});
@lokimeyburg
lokimeyburg / shooter.js
Created April 29, 2014 17:29
Take a picture with Protractor
browser.takeScreenshot().then(function (png) {
var fs = require('fs'),
buf = new Buffer(png, 'base64'),
stream = fs.createWriteStream('exception.png');
stream.write(buf);
stream.end();
});
@lokimeyburg
lokimeyburg / AppDelegate.m
Created September 29, 2014 00:21
Retrieve local images in UIWebView
#import "AppDelegate.h"
#import "LMURLImageProtocol.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[NSURLProtocol registerClass:[LMURLImageProtocol class]];
// etc
@lokimeyburg
lokimeyburg / pm-interview-questions.md
Last active October 10, 2024 06:42
Product Manager Interview Questions

Product Manager Interview Questions

General Questions:

  • Tell me about yourself.
  • Tell me about the most boring job you have ever had.
  • What changes would you make if you came on board?
  • What would you say to your boss if he is crazy about an idea, but you think it stinks?
  • Assuming that you are selected, what will be your strategy for next 60 days?
  • why are not you earning more money at this stage of your career?