Skip to content

Instantly share code, notes, and snippets.

View oss92's full-sized avatar
:octocat:
Focusing

Mohamed Osama oss92

:octocat:
Focusing
View GitHub Profile
@oss92
oss92 / EventSystem.js
Created March 29, 2016 16:19 — forked from minwe/EventSystem.js
Global event system for React.js
var EventSystem = (function() {
var self = this;
self.queue = {};
return {
publish: function (event, data) {
var queue = self.queue[event];
if (typeof queue === 'undefined') {
@oss92
oss92 / mongodb_collection_sizes.js
Last active March 15, 2016 13:50 — forked from joeyAghion/mongodb_collection_sizes.js
List mongodb collections in descending order of size. Helpful for finding largest collections. First number is "size," second is "storageSize."
function getReadableFileSizeString(fileSizeInBytes) {
var i = -1;
var byteUnits = [' kB', ' MB', ' GB', ' TB'];
do {
fileSizeInBytes = fileSizeInBytes / 1024;
i++;
} while (fileSizeInBytes > 1024);
return Math.max(fileSizeInBytes, 0.1).toFixed(1) + byteUnits[i];
@oss92
oss92 / gist:932f1422cda2766a5fb8
Created February 9, 2016 21:58 — forked from ryansobol/gist:5252653
15 Questions to Ask During a Ruby Interview

Originally published in June 2008

When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.

To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.

What to expect

Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.

@oss92
oss92 / silent.js
Created February 9, 2016 11:35 — forked from inlanger/silent.js
Silent catch uncaughtException in NodeJS From http://shapeshed.com/uncaught-exceptions-in-node/
process.on('uncaughtException', function (err) {
console.log(err);
});
module Animal
def teach_all(technique, &block)
puts "Teaching All #{self.name} the command #{technique}"
define_method technique, block
end
def unteach_all(technique)
puts "Teaching All #{self.name} the command #{technique}"
remove_method technique
@oss92
oss92 / 30-income-calculon.pl
Created January 21, 2016 23:15 — forked from avar/30-income-calculon.pl
Calculate your income in The Netherlands with and without a 30% ruling.
# To check if this is up-to-date with the tax rates go to
# http://www.expatax.nl/tax-rates-2015.php and see if there's anything
# newer there.
#
# I make no guarantees that any of this is correct. I calculated this
# at the time and have been updating it when new tax rates come along
# because people keep finding this useful.
#
# There's also an interactive JS version of this created by
# @stevermeister at
curl -s https://api.github.com/orgs/twitter/repos?per_page=200 | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'
@oss92
oss92 / farm.py
Created May 9, 2014 17:17 — forked from minrk/farm.py
"""
Simple task farm, with routed replies in pyzmq
For http://stackoverflow.com/questions/7809200/implementing-task-farm-messaging-pattern-with-zeromq
Note that things are run in threads to keep stuff in one file, there is no
reason they need to be.
License: Public Domain