Skip to content

Instantly share code, notes, and snippets.

Back in OSS business

Mohsen Azimi mohsen1

Back in OSS business
Block or report user

Report or block mohsen1

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
mohsen1 / domenic.js
Last active Aug 29, 2015
Promises and callback
View domenic.js
function add (arg1, arg2, cb) {
return (new Promise(reject, resolve) {
if (typeof arg1 !== 'number') {
reject(new TypeError('arg1 should be a number'));
if (typeof arg2 !== 'number') {
reject(new TypeError('arg2 should be a number'));
View 1.json
"apiVersion": "1.0.0",
"swaggerVersion": "1.2",
"basePath": "",
"resourcePath": "/people/@me",
"produces": [
"consumes": [
mohsen1 / _
Last active Aug 29, 2015
Proof of concept using lodash for Backbone by cherry-picking all _.{method}s that Backbone uses from Lodash
View _
mohsen1 / download.js
Last active Mar 30, 2019
Download Chromecast backgrounds
View download.js
var https = require('https');
var fs = require('fs');
var url = '';
Array.prototype.getLast = function() {
return this[this.length - 1];
function logFail(err){
mohsen1 / consolidated.json
Created May 21, 2014
Consolidated JSON Spec
View consolidated.json
"opts": {
"properties": {
"modelPackage": "com.reverb.models",
"apiPackage": "com.reverb.apis",
"groupId": "com.reverb.swagger",
"artifactId": "swagger-client",
"artifactVersion": "1.0.0"
"uri": ""
mohsen1 / words.js
Last active Dec 31, 2015
1000 most frequently used words
View words.js
names = [
mohsen1 / style.css
Last active Dec 18, 2015
Github dark theme This theme uses webkit filters to achive a consistent dark theme across all Github pages.
View style.css
/* Invert all the things! */
-webkit-filter: invert(1) grayscale(0.6);
/* Execpt these guys... */
View fs.js
var fs = require('fs');
var random = (~~(Math.random() * 1e9)).toString(2);
fs.writeFile('./random.txt', random, function(err){
if(err) console.error(err);
else console.log('file has been written');
mohsen1 / reactor.js
Last active Apr 22, 2020
Reactor Pattern in JavaScript
View reactor.js
function Event(name){ = name;
this.callbacks = [];
Event.prototype.registerCallback = function(callback){
function Reactor(){ = {};
mohsen1 /
Last active Dec 14, 2015
Classical Inheritance in JavaScript which never uses prototype object. This is bad code. It's here to demonstrate how bad Classical Inheritance is!

Let me introduce you to Classical Inheritance that never uses prototype. This is a bad coding exercise but will teach you the real Classical Inheritance which always compared to prototypal inheritance:

Make a custructor:

function Person(name, age){ = name;
  this.age = age;
  this.sayHello = function(){return "Hello! this is " +;}
You can’t perform that action at this time.