Skip to content

Instantly share code, notes, and snippets.

View zaiste's full-sized avatar
🌀
Loading...

Jakub Neander zaiste

🌀
Loading...
View GitHub Profile
@zaiste
zaiste / reasonml-getting-started.org
Last active May 12, 2018 15:08
Reason in a nutshell: Getting Started Guide

Reason in a nutshell: Getting Started Guide

This guide intends to provide a comprehensive, but relatively short introduction to Reason.

Reason is a programming language built on top of OCaml. It provides functional and object-oriented features with type-safety and focus on performance. It was created at Facebook. Its syntax is similar to JavaScript. The intention is to make interoperation with JavaScript and adoption by JavaScript programmers easier. Reason can access both JavaScript and OCaml ecosystems. OCaml was created in 1996. It is a functional programming language with infered types.

The Reason website contains an online playground. It allows to play with the language and see how the generated JavaScript looks like. It can also convert from OCaml to Reason.

@zaiste
zaiste / using_nodejs_with_async_await_elasticsearch_setup.org
Last active May 4, 2018 10:53
Using Node.js & Elasticsearch to search GitHub

In this tutorial I will be showing how to build a JavaScript application on top of Elasticsearch. Its core will be written in Node.js followed by Vue.js on the frontend. We will be using modern JavaScript specifications (ES6+) with features such as async/await, spread operator or destructuring assignment.

The tutorial will be split into several articles:

@zaiste
zaiste / rails_find_empty_or_null_column.org
Last active May 3, 2018 23:53
Rails: Find Column Null, not Null or Empty

Let’s find records where column is null or empty using Active Record

Article.where(topic: [nil, ""])

Let’s now find records where column is NOT null or empty using Active Record

@zaiste
zaiste / rails_5_or_operator_active_record.org
Last active May 3, 2018 20:34
Rails 5: OR operator in Active Record

Rails 5: OR operator in Active Record

Rails 5 allows to use or operator when building Active Record queries.

Article.where(id: 9)
  .or(Article.where(title: 'Rails 5: OR operator in Active Record'))

The query above returns a union of two relations specified. Those relations must

@zaiste
zaiste / rails_partials_with_blocks.org
Last active May 3, 2018 11:21
Rails Partials with Blocks

Partials in Rails can accept blocks. A block is a custom piece of markup. As with regular Ruby blocks, you nest the markup within do...end section of the render function.

<%= render layout: 'nav' do %>
  <li><%= link_to 'Books', books_path %></li>
  <li><%= link_to 'CDs', cds_path %></li>
@zaiste
zaiste / nodejs-child-process-spawn-exec-fork-async-await.org
Last active February 27, 2023 15:04
Node.js: Child Processes using spawn, exec, fork & async/await [DRAFT]

Node.js Child Processes using spawn, exec, fork & async/await

Blog post: https://zaiste.net/nodejs-child-process-spawn-exec-fork-async-await/

Node.js runs in a single thread. You can, however take advantage of multiple processes.

child_process module allows to create child processes in Node.js. Those processes can easily communicate with each other using a built-in messaging system.

@zaiste
zaiste / eventil_lanyrd_alternative_onestop_event_platform.md
Last active April 1, 2018 13:59
Eventil - a Lanyrd alternative: One-Stop Tech Event Platform

Eventil - a Lanyrd alternative: One-Stop Tech Event Platform

Eventil is a one-stop platform for the event industry. It provides an integrated, all-in-one solution that takes into consideration not only organizers, but also speakers, attendees, companies and swag suppliers. It aims to facilitate collaboration and to reduce the gap between all parties involved.

It is time-consuming and often not obvious how to integrate various tools used to facilitate event experience. Organizers are forced to jump between tools when preparing an event. Speakers are forced to use different communication channels when being contacted by event organizers. Attendees are forced to keep tickets in one system, see after-conferences videos somewhere else and then download presentation slides from yet another different place. Lastly, finding interesting tech conference or local events isn’t as easy as it should be.

Eventil is a one-stop solution that takes into consideration the ne

const path = require('path')
const webpack = require('webpack');
const WebpackDevServer = require('webpack-dev-server')
const middleware = require('webpack-dev-middleware');
const webpackConfig = require('./config/webpack.dev.js');
const express = require('express');
// const compiler = webpack(webpackConfig);
// const app = express();
@zaiste
zaiste / install-tmux-without-root-access.sh
Created January 18, 2018 18:53
Install tmux without root access (tmux 2.6, libevent 2.1.8, ncurses 6.0)
#!/bin/bash
set -e
mkdir -p $HOME/bin $HOME/src
cd $HOME/src
wget https://github.com/tmux/tmux/releases/download/2.6/tmux-2.6.tar.gz
wget https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz
wget https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.0.tar.gz
@zaiste
zaiste / extract-colors-in-python.py
Created January 18, 2018 17:57
Extract colors in Python
import sys
import json
from haishoku.haishoku import Haishoku
colors = []
if len(sys.argv) > 1:
url = sys.argv[1]
try: