Skip to content

Instantly share code, notes, and snippets.

View nLight's full-sized avatar
:shipit:

Dmitriy (Dima) Rozhkov nLight

:shipit:
View GitHub Profile
@caweidmann
caweidmann / eslintrc.js
Last active January 26, 2024 20:19
The "C-Dawg linter" annotation.
/*
**
** kyco.eslintrc
** =============
**
** Based on http://eslint.org/docs/rules/
**
** All rules specified in this file are taken from the URL above. We have
** included every single rule except for rules posted under the "Removed"
** section.
@paulirish
paulirish / what-forces-layout.md
Last active April 30, 2024 17:56
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@cletusw
cletusw / .eslintrc
Last active February 29, 2024 20:24
ESLint Reset - A starter .eslintrc file that resets all rules to off and includes a description of what each rule does. From here, enable the rules that you care about by changing the 0 to a 1 or 2. 1 means warning (will not affect exit code) and 2 means error (will affect exit code).
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"defaultParams": false, // enable default function parameters
"forOf": false, // enable for-of loops
"generators": false, // enable generators
"objectLiteralComputedProperties": false, // enable computed object literal property names
@tonsky
tonsky / user.keymap
Created June 4, 2014 12:04
LightTable keymap of Sublime shortcuts
{ :+
{ :editor
{ "pmeta-/" [:toggle-comment-selection]
"ctrl-shift-up" [:editor.sublime.selectLinesUpward]
"ctrl-shift-down" [:editor.sublime.selectLinesDownward]
"pmeta-d" [:editor.sublime.selectNextOccurrence]
"ctrl-m" [:editor.sublime.goToBracket]
"ctrl-shift-m" [:editor.sublime.selectBetweenBrackets]
"shift-pmeta-space" [:editor.sublime.selectScope]
"ctrl-pmeta-up" [:editor.sublime.swapLineUp]
@allgress
allgress / reagent_datascript.cljs
Last active February 16, 2023 21:16
Test use of DataScript for state management of Reagent views.
(ns reagent-test.core
(:require [reagent.core :as reagent :refer [atom]]
[datascript :as d]
[cljs-uuid-utils :as uuid]))
(enable-console-print!)
(defn bind
([conn q]
(bind conn q (atom nil)))
@swannodette
swannodette / om_data.cljs
Last active January 9, 2021 16:09
Om + DataScript
(ns om-data.core
(:require [om.core :as om :include-macros true]
[om.dom :as dom :include-macros true]
[datascript :as d]))
(enable-console-print!)
(def schema {})
(def conn (d/create-conn schema))
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active February 12, 2024 17:18
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

@zipcode
zipcode / lens.js
Created February 6, 2014 19:59
A quick and dirty jQuery implementation of Lenses. If you're into that sort of thing.
(function ($) {
$.lens = {};
$.lens.of = function (get, set) {
var lens = function (d) { return get(d); }
lens.set = set;
lens.modify = function (d, f) { return set(d, f(get(d))); }
lens.compose = function (other_lens) {
return $.lens.of(
function (d) { return other_lens(get(d)); },
@joelburget
joelburget / lenses.js
Created January 10, 2014 21:51
js lenses
var getter = function(obj, lens) {
return _(lens).foldl(function(focused, element) {
return focused[element];
}, obj);
};
var modifier = function(obj, lens, mod) {
if (lens.length === 0) {
return mod(obj);
} else {
@benschw
benschw / Dockerfile
Last active October 1, 2018 18:30
MySQL Docker Container
FROM ubuntu
RUN dpkg-divert --local --rename --add /sbin/initctl
RUN ln -s /bin/true /sbin/initctl
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get -y install mysql-client mysql-server