Skip to content

Instantly share code, notes, and snippets.

View ivpal's full-sized avatar

Pavel Ivanov ivpal

View GitHub Profile
@harlow
harlow / golang_job_queue.md
Last active April 24, 2024 10:21
Job queues in Golang

Разделение приложения на слои

Многие, кто писал приложение на yii 1.x, (на самом деле как я понимаю все нижеописанное актуально и для yii 2.x) и если проект достаточно сложный,n в какой то момент приходил к ситуации, что модели становились толстые, что, количество сценариев в модели растет, методы beforeSave, beforeValidate, afterValidate становятся неуправляемые и все это превращается в нетестируемый, неуправляемый код. И тут появляется то самое чувство, что ты делаешь что-то не так.

@Rydgel
Rydgel / gist.hs
Created August 12, 2015 08:12
haskell async http requests example
{-# OPTIONS_GHC -Wall -O2 -threaded -with-rtsopts="-N" #-}
import Control.Concurrent
import Control.Concurrent.Async
import Control.Lens
import Control.Monad
import Data.ByteString.Lazy hiding (replicate)
import Data.List.Split
import Network.Wreq hiding (getWith)
import Network.Wreq.Session
@namiazad
namiazad / To Byte Sequence Converter.scala
Last active February 9, 2018 06:59
A Scala DSL to convert data to a byte sequence representation
import java.io.{ByteArrayOutputStream, DataOutputStream}
import shapeless._
case class Container(dos: DataOutputStream, baos: ByteArrayOutputStream) {
def ~[A: ByteSequenceRepr](arg: A) = implicitly[ByteSequenceRepr[A]].toByteSequence(this, arg)
def ~| : Array[Byte] = {
dos.close()
baos.toByteArray
}
import scalaz._
import scalaz.std.list._
import scalaz.syntax.monad._
import scalaz.syntax.monoid._
import scalaz.syntax.traverse.{ToFunctorOps => _, _}
class Foo[F[+_] : Monad, A, B](val execute: Foo.Request[A] => F[B], val joins: Foo.Request[A] => B => List[Foo.Request[A]])(implicit J: Foo.Join[A, B]) {
def bar: Foo[({type l[+a]=WriterT[F, Log[A, B], a]})#l, A, B] = {
type TraceW[FF[+_], +AA] = WriterT[FF, Log[A, B], AA]
@androidfred
androidfred / haskell_stack_and_intellij_idea_ide_setup_tutorial_how_to_get_started.md
Last active February 4, 2024 20:58
Haskell, Stack and Intellij IDEA IDE setup tutorial how to get started

Haskell, Stack and Intellij IDEA IDE setup tutorial how to get started

Upon completion you will have a sane, productive Haskell environment adhering to best practices.

Basics

  • Haskell is a programming language.
  • Stack is tool for Haskell projects. (similar tools for other languages include Maven, Gradle, npm, RubyGems etc)
  • Intellij IDEA IDE is a popular IDE.

Install required libraries

sudo apt-get install libtinfo-dev libghc-zlib-dev libghc-zlib-bindings-dev

@remarkablemark
remarkablemark / Dockerfile
Last active April 24, 2024 13:40
Install node and npm with nvm using Docker.
# set the base image to Debian
# https://hub.docker.com/_/debian/
FROM debian:latest
# replace shell with bash so we can source files
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# update the repository sources list
# and install dependencies
RUN apt-get update \
@WebRTCGame
WebRTCGame / JavascriptBooks.md
Last active April 10, 2024 01:44
Free Javascript Books

Useful Links

23 Free JavaScript Books

A curated collection of awesome & free JavaScript books to help you learn the JavaScript programming language.

If you know of any other free JavaScript books that you think should be on this list, please let me know in the comments section and I will get them added.

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
@JacobBennett
JacobBennett / blog.md
Last active October 21, 2023 17:30
Clean up your Vue modules with ES6 Arrow Functions

Recently when refactoring a Vue 1.0 application, I utilized ES6 arrow functions to clean up the code and make things a bit more consistent before updating to Vue 2.0. Along the way I made a few mistakes and wanted to share the lessons I learned as well as offer a few conventions that I will be using in my Vue applications moving forward.

The best way to explain this is with an example so lets start there. I'm going to throw a rather large block of code at you here, but stick with me and we will move through it a piece at a time.

<script>

// require vue-resource...

new Vue({