Skip to content

Instantly share code, notes, and snippets.

View postcss-preset.js
const postcss = require('postcss');
const defaultOptions = {
bundler: null,
browsers: 'Chrome >= 45, ff >= 40, ie >= 10, Safari >= 8'
};
const plugin = postcss.plugin('postcss-dialog', (_options) => {
const options = Object.assign(defaultOptions, _options);
View localStorage.html
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript">
function testLocalStorage() {
for (var i = 0; i < 1000; i++) {
localStorage.setItem(i, i);
View ActorApp.txt
Process: Electron [44962]
Path: /Applications/Actor.app/Contents/MacOS/Electron
Identifier: im.actor.app
Version: 0.36.8 (0.36.8)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Electron [44962]
User ID: 501
Date/Time: 2016-04-05 01:26:38.672 +0300
View npm.conf
proxy_cache_path /var/www/npm_cache levels=2:2 keys_zone=npm_cache:10m max_size=20g inactive=1M use_temp_path=off;
server {
listen 80;
server_name npm.example.com;
location / {
rewrite ^ https://npm.example.com$request_uri permanent;
}
}
View webpack.config.js
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const env = process.env.NODE_ENV || 'development'; // eslint-disable-line
const development = env === 'development';
const production = env === 'production';
const config = module.exports = {
View actor.js
function actor(){
var $wnd_0 = window, $doc_0 = document, gwtOnLoad_0, bodyDone, base = '', metaProps = {}, values = [], providers = [], answers = [], softPermutationId = 0, onLoadErrorFunc, propertyErrorFunc;
if (!$wnd_0.__gwt_stylesLoaded) {
$wnd_0.__gwt_stylesLoaded = {};
}
if (!$wnd_0.__gwt_scriptsLoaded) {
$wnd_0.__gwt_scriptsLoaded = {};
}
function isHostedMode(){
var result = false;
View create-async-action.js
import isFunction from 'lodash/isFunction';
function createAsyncAction(type, promise) {
return (dispatch) => {
dispatch({
type,
meta: {
pending: true
}
});
View InfinityScroll.js
const React = require('react');
const EventListener = require('react/lib/EventListener');
const {shouldComponentUpdate} = require('react/lib/ReactComponentWithPureRenderMixin');
const debounce = require('lodash/function/debounce');
const InfinityScroll = React.createClass({
propTypes: {
children: React.PropTypes.node.isRequired,
threshold: React.PropTypes.number.isRequired,
onNextPage: React.PropTypes.func.isRequired,
View microservice-bcrypt.go
package main
import (
"log"
"net/http"
"encoding/json"
"golang.org/x/crypto/bcrypt"
)
type HashRequest struct {
@nkt
nkt / server.conf
Created Nov 5, 2015
Nginx configuration for separated frontend and backend endpoints
View server.conf
upstream example-webpack {
server 127.0.0.1:8080;
}
upstream example-backend {
server 127.0.0.1:3000;
}
server {
listen 80;