Skip to content

Instantly share code, notes, and snippets.

@dimapaloskin
dimapaloskin / App.js
Created October 6, 2017 07:52
Mobx + react-router-dom 4 auth helper
import React, { Component } from 'react'
import {
BrowserRouter as Router,
Route
} from 'react-router-dom'
import Auth from './Auth'
/* here mobx stuff */
class App extends Component {
@RichardBronosky
RichardBronosky / 0-TLDR.md
Last active March 23, 2024 15:09 — forked from datagrok/git-serve.md
How to easily launch a temporary one-off git server from any local repository, to enable a peer-to-peer git workflow.

User 1

remote_server=172.31.0.1
git daemon --verbose --export-all --base-path=.git --reuseaddr --strict-paths .git/ > /tmp/git-serve.log 2>&1 &
ssh -R 9418:localhost:9418 ec2-user@$remote_server
git clone git://localhost/ local-repo-name

Repo from workstation is cloned onto server.

User 2

@cweekly
cweekly / how-to-image-magick-icons
Last active May 17, 2021 20:23
CLI ImageMagick (convert, mogrify, etc) create multi-layer favicon.ico from svg
$ brew install imagemagick
# `convert` and `mogrify` provided by imagemagick
$ mogrify --version
Version: ImageMagick 7.0.7-3 Q16 x86_64 2017-09-18 http://www.imagemagick.org
Copyright: © 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules
Delegates (built-in): bzlib freetype jng jpeg ltdl lzma png tiff xml zlib
# "mogrify quite useful in converting icons to multilayered ICO format from SVG images.
@dfontana
dfontana / CmderZSH.md
Last active March 12, 2023 21:45
My setup guide for installing Cgywin, Mintty, Cmder, and ZSH.

What's this?

Instructions to obtain ZSH on a windows environment, without the input funny business presented by some other attempted solutions.

The final result is ZSH running on a mintty terminal, emulated by cygwin, and being handled by the popular cmder.

Why is this here?

For the benefit of myself and others. I've already followed these instructions twice. It took me hours to figure all this out, maybe someone else can save a few.

What exactly is covered?

  • Installing and setting up cmder
@royling
royling / tmux-iterm2.md
Last active April 24, 2023 19:35
tmux in iTerm2 cheatsheet
@markerikson
markerikson / nodeenvDiscussion.md
Last active January 9, 2023 15:24
Summary of process.env.NODE_ENV and its use with Webpack

[02:06 PM] acemarke: @Steven : a couple other thoughts on the whole NODE_ENV thing. First, per my comments, it really is a Node concept. It's a system environment variable that Node exposes to your application, and apparently the Express web server library popularized using its value to determine whether to do optimizations or not
[02:08 PM] acemarke: Second, because of its use within the Node ecosystem, web-focused libraries also started using it to determine whether to they were being run in a "development" environment vs a "production" environment, with corresponding optimizations. For example, React uses that as the equivalent of a C #ifdef to act as conditional checking for debug logging and perf tracking. If process.env.NODE_ENV is set to "production", all those if clauses will evaluate to false.
Third, in conjunction with a tool like UglifyJS that does minification and removal of dead code blocks, a clause that is surrounded with if(process.env.NODE_ENV !== "development")

require 'minitest/autorun'
class ProcAndLambdaTest < Minitest::Test
def setup
@arr = [ 1, 2, 3 ]
end
def test_basic_return_behavior
# NOTE: Defining methods like this actually hoists them into the instance. I'm doing this purely
# for organization of the tests.
@vvgomes
vvgomes / foo.js
Last active August 10, 2021 18:10
Ramda vs Lodash
var _ = require("lodash");
var R = require("ramda");
var companies = [
{ name: "tw", since: 1993 },
{ name: "pucrs", since: 1930 },
{ name: "tw br", since: 2009 }
];
var r1 = _(companies).chain()
@chantastic
chantastic / on-jsx.markdown
Last active March 20, 2024 01:03
JSX, a year in

Hi Nicholas,

I saw you tweet about JSX yesterday. It seemed like the discussion devolved pretty quickly but I wanted to share our experience over the last year. I understand your concerns. I've made similar remarks about JSX. When we started using it Planning Center, I led the charge to write React without it. I don't imagine I'd have much to say that you haven't considered but, if it's helpful, here's a pattern that changed my opinion:

The idea that "React is the V in MVC" is disingenuous. It's a good pitch but, for many of us, it feels like in invitation to repeat our history of coupled views. In practice, React is the V and the C. Dan Abramov describes the division as Smart and Dumb Components. At our office, we call them stateless and container components (view-controllers if we're Flux). The idea is pretty simple: components can't