Instantly share code, notes, and snippets.

View promises_branching.js
var Promise = require('bluebird');
console.log('=== Branching promises demo ===');
function getNameById(id) {
return Promise.resolve("Ziutek");
Add missing data to object.
View noise_level_meter.ino
#include <ESP8266HTTPClient.h>
#include <ESP8266WiFi.h>
const int sampleWindow = 50; // Sample window width in mS (50 mS = 20Hz)
unsigned int sample;
#define BLINK_LED 16
#define WIFI_LED_PIN 16
#define NUM_MEASURES 1200 // Sampling freq. is 20 hz

Starcie monolitu i mikroserwisów

Obrona monolitu

Artykuł - Dan Haywood: In defence of Monolith Wyważone porównanie obu podejść. Część 2

Monolit musi być dobrze zmodularyzowany by był utrzymywalny. Prawdopodobnie większość monolitów taka nie jest.

Monolit dobrze się sprawdza w złożonej domenie biznesowej, mikroserwisy błyszczą tam, gdzie jest wielka skala.

View learn_bluebird.js
// npm install bluebird
// npm install superagent
var Promise = require('bluebird');
var request = require('superagent');
console.log('Promises with Bluebird');
function get(url) {
View CoronaSDK-Module.lua
local M = {}
function M.create()
-- initialize members: = "bar"
return M
View CoronaSDK-Snippets.lua
-- Disable pixel smoothing
display.setDefault( "magTextureFilter", "nearest" )
-- Physics debugging: place in scene file in global scope
physics.setDrawMode( "hybrid" )
View SimpleAnimatoin.swift
//: Playground - noun: a place where people can play
// 1. Create new iOS playground
// 2. Paste this code
// 3. Enable timeline slider (on Utilities panel, alt+cmd+0 to show)
// 4. After letting the animation play, move the slider :)
import UIKit
import XCPlayground
View AppDelegate.swift
// MARK: - Core Data stack
lazy var applicationDocumentsDirectory: NSURL = {
// The directory the application uses to store the Core Data store file. This code uses a directory named "net.japko.EmptyCoreDataSwiftProject" in the application's documents Application Support directory.
let urls = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)
return urls[urls.count-1] as NSURL
lazy var managedObjectModel: NSManagedObjectModel = {
// The managed object model for the application. This property is not optional. It is a fatal error for the application not to be able to find and load its model.
View SwiftNinja2.swift
// Solution to ultimate Swift Nija challenge
enum Suit {
case Clubs, Diamonds, Hearts, Spades
enum Rank {
case Jack, Queen, King, Ace
case Num(Int)
View puzzle15.html
<!DOCTYPE html>
<html lang="">
<meta charset="UTF-8">
<link rel="stylesheet" href="">
<style type="text/css">
* {