Skip to content

Instantly share code, notes, and snippets.

:shipit:
Staring into an abyss

Sallar Kaboli sallar

:shipit:
Staring into an abyss
Block or report user

Report or block sallar

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
View keybase.md

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 Sep 7, 2011
Include jDateTime
View include.php
<?php
require_once dirname(__FILE__) . '/jdatetime.class.php';
@sallar
sallar / amd-jsdoc.md
Created Nov 30, 2015
WebStorm AMD/JSDoc Problem
View amd-jsdoc.md

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 Jan 25, 2016
Redux Reducers Example
View reducer.js
function reducer(state = []) {
return [...state, {
title: "Test",
completed: false
}];
}
@sallar
sallar / index.js
Created Oct 18, 2016
requirebin sketch
View index.js
const { normalize, Schema, arrayOf } = require('normalizr');
const { v4 } = require('uuid');
const group = new Schema('groups');
const groups = arrayOf(group);
group.define({
children: groups
});
View index.js
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 Jul 1, 2017
Recursive Collection Utils
View collection-utils.js
// 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 Nov 20, 2017
Typescript Module Curry
View ts-curry.ts
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 Dec 2, 2017
Rust Learning
View part1.rs
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 Feb 22, 2018
Electron IPC Enqueue
View main.js
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}`);
});
You can’t perform that action at this time.