Skip to content

Instantly share code, notes, and snippets.

View sallar's full-sized avatar
:shipit:
Staring into an abyss

Sallar sallar

:shipit:
Staring into an abyss
View GitHub Profile
@sallar
sallar / keybase.md
Created October 25, 2014 20:05
Keybase

Keybase proof

I hereby claim:

  • I am sallar on github.
  • I am sallar (https://keybase.io/sallar) on keybase.
  • I have a public key whose fingerprint is 0829 0901 2FD7 5301 15F1 1DA9 8960 4063 DDF5 8CF8

To claim this, I am signing this object:

@sallar
sallar / include.php
Created September 7, 2011 20:49
Include jDateTime
<?php
require_once dirname(__FILE__) . '/jdatetime.class.php';
@sallar
sallar / amd-jsdoc.md
Created November 30, 2015 20:11
WebStorm AMD/JSDoc Problem

OK, So imagine you have this module which accepts another module as a parameter to one of it’s methods:

define("modules/module2", [], function() {

    return {
        /**
         * @param {module:myNamespace/module1} SomeModule
         */
 somethingElse: function(SomeModule) {
@sallar
sallar / reducer.js
Created January 25, 2016 14:08
Redux Reducers Example
function reducer(state = []) {
return [...state, {
title: "Test",
completed: false
}];
}
@sallar
sallar / index.js
Created October 18, 2016 11:05
requirebin sketch
const { normalize, Schema, arrayOf } = require('normalizr');
const { v4 } = require('uuid');
const group = new Schema('groups');
const groups = arrayOf(group);
group.define({
children: groups
});
@sallar
sallar / index.js
Created June 27, 2017 10:46
SES Example
const nodemailer = require('nodemailer');
const aws = require('aws-sdk');
// create Nodemailer SES transporter
const transporter = nodemailer.createTransport({
SES: new aws.SES({
apiVersion: '2010-12-01',
region: 'eu-west-1'
})
});
@sallar
sallar / collection-utils.js
Created July 1, 2017 14:13
Recursive Collection Utils
// By Sallar Kaboli
import { sortBy, at } from 'lodash';
export function sortDeepByKey(list, sortKey, childrenKey) {
if (!sortKey || !childrenKey) {
throw new Error('Insufficient data provided for sorting');
}
return sortByKey(list, sortKey).map(item => {
return {
...item,
@sallar
sallar / ts-curry.ts
Created November 20, 2017 08:40
Typescript Module Curry
module Cart {
export function test1() {
console.log('hi');
}
export function test2() { }
}
function curryModule<T>(mod: T): T {
return Object
.keys(mod)
@sallar
sallar / part1.rs
Last active December 2, 2017 21:15
Rust Learning
enum SomethingOrNothing<T> {
Something(T),
Nothing,
}
use self::SomethingOrNothing::*;
use std::io::prelude::*;
use std::io;
pub trait Minimum: Copy {
@sallar
sallar / main.js
Created February 22, 2018 17:10
Electron IPC Enqueue
ipc.on('channel:enqueue', (e, payload) => {
const { channelName, stack, id } = payload;
getQueue()
.channel(channelName)
.enqueue(
() => {
return new Promise(resolve => {
ipc.once(`channel:resolve:${id}`, resolve);
e.sender.webContents.send(`channel:execute:${id}`);
});