Skip to content

Instantly share code, notes, and snippets.

View avevlad's full-sized avatar
🚲

Vlad Derzhavin avevlad

🚲
View GitHub Profile
@acdlite
acdlite / Dataloader.js
Last active August 15, 2018 04:36
Idea for Dataloader component
// The `loader` prop is a Dataloader instance
// https://github.com/facebook/dataloader
class Dataloader extends React.Component {
state = {data: null, isLoaded: false};
componentWillMount() {
this.prefetchData(this.props);
}
componentWillReceiveProps(nextProps) {
if (this.props.id !== nextProps.id || this.props.loader !== nextProps.loader) {
this.setState({isLoaded: false});
@iMichka
iMichka / pymol
Created May 22, 2017 21:05
pymol crash
2017-05-22 22:44:22.607 Python[33641:1749620] *** Assertion failure in +[NSScreen _invalidateIfNeededForReason:], /Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1504.83.101/AppKit.subproj/NSScreen.m:1118
2017-05-22 22:44:22.628 Python[33641:1749620] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSScreen reconfig must only happen on the main thread.'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff85a872cb __exceptionPreprocess + 171
1 libobjc.A.dylib 0x00007fff9a89248d objc_exception_throw + 48
2 CoreFoundation 0x00007fff85a8c042 +[NSException raise:format:arguments:] + 98
3 Foundation 0x00007fff874d4c80 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195
4 AppKit 0x00007fff8370f485 +[NSScreen _invalidateIfNeededForReason:] + 153
5 AppKit 0x00007fff83737554
anonymous
anonymous / package.json
Created March 31, 2017 09:54
{
"name": "frontend-desktop",
"private": false,
"version": "1.0.0",
"description": "Quantify World front-end app",
"main": "src/index.js",
"author": "AveVlad",
"dependencies": {
"@navjobs/upload": "^1.0.3",
"accounting": "0.4.1",
anonymous
anonymous / webpack.cfg.js
Created March 31, 2017 09:54
const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const env = process.env.NODE_ENV || 'development'; // eslint-disable-line
const API_ENDPOINT = process.env.API_ENDPOINT || 'http://dev.quantify.world/api'; // eslint-disable-line
const development = env === 'development';
const production = env === 'production';
@addyosmani
addyosmani / preprocessing.md
Last active January 17, 2023 17:07
JavaScript preprocessing/precompilation

Problem: How can we preprocess JavaScript (at build-time or on the server-side) so engines like V8 don't have to spend as much time in Parse? This is a topic that involves generating either bytecode or a bytecode-like-abstraction that an engine would need to accept. For folks that don't know, modern web apps typically spend a lot longer in Parsing & Compiling JS than you may think.

  • Yoav: This can particularly be an issue on mobile. Same files getting parsed all the time for users. Theoretically if we moved the parsing work to the server-side, we would have to worry about it less.
  • One angle to this problem is we all ship too much JavaScript. That's one perspective. We could also look at preprocessing.
  • We've been talking about this topic over the last few weeks a bit with V8. There were three main options proposed.
    1. Similar to what optimize-js does. Identify IIFEs and mark them as such so the browser and VMs heuristics will catch them and do a better job than today. optimize-js only tackles IIFE bu
@travisjeffery
travisjeffery / functional-options.md
Last active April 23, 2023 11:13
How to do functional options in Golang

Here's the simplest example showing how to do functional options in Golang.

They're a great way to enable users to set options and ease adding new options later.

package main

import (
	"flag"
	"fmt"
@aclements
aclements / 17503-eliminate-rescan.md
Created October 18, 2016 20:04
Preview of proposal go/golang#17503

Proposal: Eliminate STW stack re-scanning

Author(s): Austin Clements, Rick Hudson

Last updated: 2016-10-18

Discussion at https://golang.org/issue/17503.

Abstract

@dchest
dchest / gist:c1985fd5bef3b19bf73f3165fe2e59b6
Created October 13, 2016 07:10
Secure coding guidelines for C
Don't write in C.
@statianzo
statianzo / current.js
Last active August 30, 2016 13:47
unknown props warning
const ContactBadge = (props) => (
<div className='Badge' {...props}>
<div>{props.user.name}</div>
<div>{props.contactMethod.type}</div>
</div>
);
export default connect((state, {userId, contactMethodId}) => ({
user: selectUser(state, userId),
contactMethod: selectContactMethod(state, contactMethodId)
@hlegius
hlegius / Dockerfile
Last active February 4, 2020 18:55
Docker base configuration for Scala projects with Docker (tested against Docker Beta for OS X)
FROM hseeberger/scala-sbt
# For a Alpine Linux version, comment above and uncomment below:
# FROM 1science/sbt
RUN mkdir -p /exampleapp
RUN mkdir -p /exampleapp/out
WORKDIR /exampleapp
COPY . /exampleapp