Skip to content

Instantly share code, notes, and snippets.

{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
module Lib where
import Control.Applicative
import Data.Aeson
import Data.ByteString.Lazy (ByteString)
import Data.Vector (Vector)
<?php
$withTrans = function($trans, $work): bool {
if ($work()) {
$trans->commit();
return true;
} else {
$trans->rollback();
return false;
}
@syntheticsh
syntheticsh / rioMonad.hs
Last active November 21, 2019 15:29
trying Monadic actions inside RIO
#!/usr/bin/env stack
-- stack --resolver lts-14.2 script
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
module Main (main) where
import RIO
import Control.Monad.Trans.Maybe
newtype App = App {appLogFunc :: LogFunc}
@syntheticsh
syntheticsh / Cargo.toml
Created December 14, 2018 07:39
actix_test
[package]
name = "actix_play"
version = "0.1.0"
edition = "2018"
[dependencies]
actix = "0.7"
actix-web = { version = "0.7.8", features = ["tls"] }
futures = "0.1"
serde = "1.0"
@syntheticsh
syntheticsh / init.php
Created October 30, 2018 08:02
[1c-bitrix] Инфоблок по коду
<?php
if (!function_exists("GetIBlockIDByCode")) {
function GetIBlockIDByCode($ibCode, $ibType) {
global $stackCacheManager;
if (!CModule::IncludeModule("iblock")) {
return false;
}
extern crate hyper;
extern crate futures;
extern crate tokio;
use hyper::rt::{Future, Stream};
use futures::future::select_all;
use futures::future::join_all;
use futures::future::select_ok;
use std::thread;
use std::error::Error;
extern crate hyper;
extern crate futures;
extern crate tokio;
use hyper::{Client, Response, Body};
use hyper::rt::{Future, Stream};
use futures::future::join_all;
fn main() {
let client = Client::new();