Skip to content

Instantly share code, notes, and snippets.

View limarc's full-sized avatar
🚀

Alex Lobashev limarc

🚀
  • Cyprus, Limassol
View GitHub Profile
@developit
developit / *state-machine-component.md
Last active February 6, 2021 00:44
265b lib for building pure functional state machine components. https://github.com/developit/state-machine-component

state-machine-component

A tiny (265 byte) utility to create state machine components using two pure functions.

🔥 JSFiddle Demo

Usage

The API is a single function that accepts 2 pure functions as arguments:

@gaearon
gaearon / slim-redux.js
Last active September 7, 2025 15:41
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {

Contributing

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Please note we have a code of conduct, please follow it in all your interactions with the project.

Pull Request Process

  1. Ensure any install or build dependencies are removed before the end of the layer when doing a
@jacek-dargiel
jacek-dargiel / gulpfile.js
Last active August 29, 2015 14:17
gulp-webpack-build watch runs first time only
// Simplified gulpfile
var gulp = require('gulp'),
watch = require('gulp-watch'),
webpack = require('gulp-webpack-build');
var CONFIG = {
paths: {
build: 'build',
input: {
@pradeepn
pradeepn / WebsocketClient.js
Last active August 29, 2015 14:14
Websocket Client Implementation
//JS Client For Websockets Server
//For C# Use Fleck & NetSockets
//https://github.com/statianzo/Fleck
//https://netsockets.codeplex.com/Wikipage?ProjectName=netsockets
var ws;
$(document).ready(function () {
// test if the browser supports web sockets
if ("WebSocket" in window) {
debug("Browser supports web sockets!", 'success');
@denji
denji / nginx-tuning.md
Last active December 6, 2025 06:25
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@eweitnauer
eweitnauer / Font.js
Last active April 12, 2024 23:00
Font.js Demo
/**
Font.js v2012.01.25
(c) Mike "Pomax" Kamermans, 2012
Licensed under MIT ("expat" flavour) license.
Hosted on http://github.com/Pomax/Font.js
This library adds Font objects to the general pool
of available JavaScript objects, so that you can load
fonts through a JavaScript object similar to loading
@CMCDragonkai
CMCDragonkai / angularjs_directive_attribute_explanation.md
Last active September 18, 2025 20:18
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
@tedmiston
tedmiston / nodejs-tcp-example.js
Last active April 1, 2025 08:06
Node.js TCP client and server example
/*
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp
server, but for some reason omit a client connecting to it. I added an
example at the bottom.
Save the following server in example.js:
*/
var net = require('net');