Skip to content

Instantly share code, notes, and snippets.

View ducin's full-sized avatar
🛠️
creatin' some stuff

Tomasz Ducin ducin

🛠️
creatin' some stuff
View GitHub Profile
@ducin
ducin / actions.ts
Last active February 15, 2021 01:02
redux setup
import { INC } from './constants';
export const Inc = () => ({
type: INC as typeof INC
})
export type Actions =
| ReturnType<typeof Inc>
@ducin
ducin / api.md
Last active November 16, 2020 09:29
Mock REST API typings and cheat sheet
@ducin
ducin / ecommerce-order.json
Created January 26, 2020 17:12
various json schemas
{
"type": "object",
"properties": {
"orderId": {
"type": "string",
"faker": "random.uuid"
},
"customer": {
"type": "string",
"faker": "name.findName"
@ducin
ducin / LICENSE
Created December 28, 2018 13:12
Lorem Ipsum License
Lorem Ipsum License
Copyright (c) [year] [fullname]
Permission is Lorem ipsum hereby granted, dolor sit amet, free of charge,
to any person obtaining a copy consectetur adipiscing elit. Proin nibh augue
of this software and associated documentation files (the "Software"),
suscipit a, scelerisque sed, to deal lacinia in, mi. Cras vel lorem.
Etiam pellentesque aliquet tellus, in the Software without restriction,
Phasellus pharetra nulla ac diam. Quisque semper justo at risus including
@ducin
ducin / .gitignore
Last active November 15, 2018 13:58
data.json
node_modules
@ducin
ducin / model.js
Created September 15, 2018 18:31
const API_URL = 'http://localhost:3011/'
const OfficeModel = {
getCollection(){
return fetch(`${API_URL}offices`)
.then(res => res.json())
},
async __extendOfficeWithEmployees(office){
const employees = await EmployeeModel.getCollection(office.city)
return { ...office, employees }
@ducin
ducin / knotify.py
Created August 4, 2013 21:53
KNotify (KDE DBUS notifications); use it with: ./knotify.py "header" "content" (credited to http://www.documentroot.net/en/linux/knotify-python)
#!/usr/bin/python
import sys, dbus
knotify = dbus.SessionBus().get_object("org.kde.knotify", "/Notify")
try: title, text = sys.argv[1:3]
except: print 'Usage: knotify.py title text'; sys.exit(1)
knotify.event("warning", "kde", [], title, text, [], [], 0, 0, dbus_interface="org.kde.KNotify")
@ducin
ducin / README.md
Last active April 15, 2018 15:33
JSON-Schema-faker console basic demo

JSON-Schema-faker demo

Run the following:

npm install
node run.js

to execute the demo.

@ducin
ducin / sshfs.sh
Created January 22, 2014 07:33
simple script opening/closing sshfs connection with ./sshfs.sh -o or ./sshfs.sh -c
#!/bin/bash
if [ "$1" != "" ]; then
case $1 in
-o | --open ) echo "$USER opening sshfs connection"
open your connection here
;;
-c | --close ) echo "$USER closing sshfs connection"
close your connection here
;;
@ducin
ducin / readme.md
Last active April 21, 2017 17:54
resolvedSame - new promise aggregate

resolveSame - new promise aggregate

  • if all promises get rejected - aggregate gets rejected (with positional reasons)
  • if some promises get resolved, then:
    • if they all get resolved with the same value - aggregate gets resolved with theValue
    • otherwise (different resolved values) - aggregate gets rejected with first two different values