Skip to content

Instantly share code, notes, and snippets.

View cryptoquick's full-sized avatar
🦀
Any application that can be written in Rust, will eventually be written in Rust.

Hunter Beast cryptoquick

🦀
Any application that can be written in Rust, will eventually be written in Rust.
View GitHub Profile
@mixin icon($icon) {
//@extend %icon;
font-family: FontAwesome;
font-weight: normal;
font-style: normal;
display: inline-block;
text-decoration: inherit;
line-height: 1;
content: $icon;
}
@creationix
creationix / custominspect.js
Last active December 14, 2015 02:39
When working with typed arrays in node.js, make sure to give them custom inspect methods. Otherwise logging large values will blow up your console.
ArrayBuffer.prototype.inspect = function () {
return "<ArrayBuffer (0x" + this.byteLength.toString(16) + " bytes)>";
}
Uint8Array.prototype.inspect = function () {
var str = "<" + this.constructor.name;
for (var i = 0, l = Math.min(32, this.length); i < l; i++) {
str += " " + this[i].toString(16);
}
if (l < this.length) {
str += " (0x" + this.length.toString(16) + " total)";
@wmertens
wmertens / router.jsx
Last active August 10, 2017 11:14
Wrapper for react-router v4 with an API more to my tastes
import React, {Component, PropTypes} from 'react'
import {Link, Route as OrigRoute, Switch, Redirect, BrowserRouter as Router, withRouter} from 'react-router-dom'
// Subscribes a child to history updates, passing the current location as a prop
// This is needed to work around the React context API not updating all children
// See https://github.com/ReactTraining/react-router/issues/4629#issuecomment-284218493
export class LocationListener extends Component {
static contextTypes = {
history: PropTypes.object,
}
@machty
machty / nested-loading-routes.md
Created October 8, 2013 05:23
Proposal for nested loading routes in Ember.js

Loading Route Facelift

LoadingRoute has existed for a while, but it's barely useful and largely broken. It's never gotten much love due to it largely being a hangover of the router.js microlib, and we can make it better. The problems with LoadingRoute are intertwined with issues with facelift router's handling of async transitions in some cases, but of which need to be addressed, but here's a list of problems related to both:

  • There's only one global LoadingRoute that gets activated when
let yCombinator = f => (g => (...p) => f(g(g))(...p))(g => (...p) => f(g(g))(...p))
var factory = f => (...a) => a.length - a[0].length > 1 ? f.call.call(...a) : f.bind(null, ...a)
//
// we could add some fancy code to eliminate fn.call & fn.bind
//
// var topsy = (f => f.bind(f))(Function.call)
// var turvy = (f => f.bind(f))(Function.bind)
// var factory = f => (...a) => (a.length - a[0].length > 1 ? topsy : turvy(f, null))(...a)
//
@visnup
visnup / listenOnPortOrSocketFile.js
Last active May 17, 2019 11:57
Listen on a TCP port or a UNIX socket file in node.js. Handle EADDRINUSE for the socket file by deleting it and re-listening.
var fs = require('fs')
, net = require('net')
, http = require('http')
, port = process.env.PORT;
var app = function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
};
@MattiasBuelens
MattiasBuelens / streams.ts
Created June 27, 2018 18:55
Workaround for WHATWG streams in TypeScript
import {
ReadableStream as WhatWGReadableStream,
TransformStream as WhatWGTransformStream,
WritableStream as WhatWGWritableStream
} from 'whatwg-streams';
export type ReadableStream<R> = WhatWGReadableStream<R>;
export const ReadableStream: typeof WhatWGReadableStream = (self as any).ReadableStream;
export type WritableStream<W> = WhatWGWritableStream<W>;
@mbreit
mbreit / font-awesome.css.sass
Last active March 29, 2021 04:52
Using Font Awesome with SASS and mixins for adding icons to semantic HTML
$fontawesome_path: "." !default
@font-face
font-family: 'FontAwesome'
src: font-url('#{$fontawesome_path}/fontawesome-webfont.eot')
src: font-url('#{$fontawesome_path}/fontawesome-webfont.eot?#iefix') format("embedded-opentype"), font-url('#{$fontawesome_path}/fontawesome-webfont.woff') format("woff"), font-url('#{$fontawesome_path}/fontawesome-webfont.ttf') format("truetype")
font-weight: normal
font-style: normal
@mixin icon($icon)
@mariodian
mariodian / nbxplorer.service
Created November 8, 2018 05:17
NBXplorer Systemd Service
[Unit]
Description=NBXplorer daemon
Requires=bitcoind.service
After=bitcoind.service
[Service]
ExecStart=/usr/bin/dotnet "/home/satoshi/source/NBXplorer/NBXplorer/bin/Release/netcoreapp2.1/NBXplorer.dll" -c /home/satoshi/.nbxplorer/Main/settings.config
User=satoshi
Group=satoshi
Type=simple