Skip to content

Instantly share code, notes, and snippets.

Andrey Antukh niwinz

Block or report user

Report or block niwinz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@niwinz
niwinz / dynamicObject.js
Last active Oct 1, 2018
GraphQL Dynamic Object.
View dynamicObject.js
const {GraphQLError} = require("graphql/error");
const {Kind} = require("graphql/language");
const g = require("graphql");
function parseLiteral(ast) {
switch (ast.kind) {
case Kind.STRING:
case Kind.BOOLEAN:
return ast.value;
case Kind.INT:
View SimpleHTTPServer.cs
// MIT License - Copyright (c) 2016 Can Güney Aksakalli
// https://aksakalli.github.io/2014/02/24/simple-http-server-with-csparp.html
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
using System.Net;
using System.IO;
@niwinz
niwinz / core.clj
Last active Nov 22, 2017
Recycle Iteration
View core.clj
;; BOOT_CLOJURE_NAME=org.clojure/clojure
;; BOOT_CLOJURE_VERSION=1.9.0-RC1
;; BOOT_VERSION=2.7.2
;; BOOT_JVM_OPTIONS="-Xms4g -Xmx4g -XX:+UseG1GC -XX:+AggressiveOpts -server"
(set-env! :dependencies '[[org.clojure/core.async "0.3.443"]
[org.clojure/clojure "1.9.0-RC1"]])
(require '[clojure.core.async :as a]
'[clojure.core.async.impl.protocols :as ap])
View sablono-hacks.clj
(ns your.macros-for-cljs.ns
(:require [sablono.compiler :as sablono-c]))
;; Make sablono also walk into other forms:
;; if, for, let, do: Already exist
(.addMethod @(var sablono-c/compile-form) "when"
(fn
[[_ bindings & body]]
`(when ~bindings ~@(for [x body] (sablono-c/compile-html x)))))
@niwinz
niwinz / es6-class-react.cljs
Created Apr 8, 2017 — forked from dvingo/es6-class-react.cljs
React component in pure cljs using ES6 class inheritance
View es6-class-react.cljs
;; implementing a React component in pure cljs, no reagent necessary
;; using goog.object.extend to create a ES6 class that inherits from
;; React.Component
;; credit to @thheller
(defn MyReact [props context updater]
(this-as this
(js/React.Component.call this props context updater)))
View for-like-macros.cljs
(defmacro afor
"Like for but eagerly builds a JS array.
Usually for react consumption."
[[item coll] & body]
`(let [coll# ~coll
neue# (cljs.core/array)]
(loop [xs# coll#
idx# 0]
(let [f-item# (first xs#)]
@niwinz
niwinz / infinite.js
Created Jan 17, 2017 — forked from threepointone/infinite.js
infinite scrolling pattern with react fiber (featuring intersection observers)
View infinite.js
// inifinite scrolling of content without extra wrappers
const { render, findDOMNode } = ReactDOMFiber
class App extends React.Component {
render() {
// wrap the root element with an Intersection Observer, exposing .observe for children
return <Intersection>
<div style={{ height: 200, overflow: 'auto' }}>
<Page offset={0} count={10} />
</div>
@niwinz
niwinz / leaflet.cljs
Created Jan 9, 2017 — forked from attentive/leaflet.cljs
Adapting React components in Rum
View leaflet.cljs
(ns project.leaflet
(:require-macros [project.macros :as m])
(:require [rum.core :as rum]
cljsjs.react-leaflet)) ;; js/ReactLeaflet
(m/adapt-react leaflet-map js/ReactLeaflet.Map)
(m/adapt-react tile-layer js/ReactLeaflet.TileLayer)
(m/adapt-react marker js/ReactLeaflet.Marker)
(m/adapt-react popup js/ReactLeaflet.Popup)
@niwinz
niwinz / core.clj
Created Nov 25, 2016 — forked from mikeball/core.clj
Postgres listen/notify in Clojure using http://impossibl.github.io/pgjdbc-ng/
View core.clj
; Postgres listen/notify in Clojure using http://impossibl.github.io/pgjdbc-ng/
; in project.clj dependencies
; [com.impossibl.pgjdbc-ng/pgjdbc-ng "0.5"]
(ns pglisten.core
(:import [com.impossibl.postgres.jdbc PGDataSource]
[com.impossibl.postgres.api.jdbc PGNotificationListener]))
@niwinz
niwinz / README.md
Created Oct 26, 2016
How to enable SecureBoot with own keys in KVM and on a laptop (T450s)
View README.md

UEFI SecureBoot on ArchLinux

For KVM and Laptop

Rationale

I want full control what boots the computer to avoid the so called evil maid attack. That requires setting SecureBoot with only my own keys.

Intro

You can’t perform that action at this time.