Skip to content

Instantly share code, notes, and snippets.

Avatar
🛠️
creatin' some stuff

Tomasz Ducin ducin

🛠️
creatin' some stuff
View GitHub Profile
View .gitignore
node_modules
View model.js
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 Aug 4, 2013
KNotify (KDE DBUS notifications); use it with: ./knotify.py "header" "content" (credited to http://www.documentroot.net/en/linux/knotify-python)
View knotify.py
#!/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 / index.html
Last active Jul 13, 2018
sinon fake server demo
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Sinon.js fakeServer demo</title>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/sinon.js/1.7.3/sinon-min.js"></script>
<script src="sinon-fake-server.js"></script>
</head>
<body>
@ducin
ducin / README.md
Last active Apr 15, 2018
JSON-Schema-faker console basic demo
View README.md

JSON-Schema-faker demo

Run the following:

npm install
node run.js

to execute the demo.

@ducin
ducin / sshfs.sh
Created Jan 22, 2014
simple script opening/closing sshfs connection with ./sshfs.sh -o or ./sshfs.sh -c
View sshfs.sh
#!/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 Apr 21, 2017
resolvedSame - new promise aggregate
View readme.md

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
View js-csp.built.js
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define("csp", [], factory);
else if(typeof exports === 'object')
exports["csp"] = factory();
else
root["csp"] = factory();
})(this, function() {
@ducin
ducin / reveal.js
Created Sep 19, 2016
REVEAL.JS bonus
View reveal.js
Reveal.configure({
keyboard: {
40: 'next',
38: 'prev'
}
});