Skip to content

Instantly share code, notes, and snippets.

View lehtu's full-sized avatar
:octocat:

Juho Lehtinen lehtu

:octocat:
View GitHub Profile
@lehtu
lehtu / slowness-of-a-git-for-windows.md
Last active March 27, 2023 12:03
This gist has observations and maybe some solutions for Git for Windows being extremely slow.

Problem

Git for Windows slows down a lot after network change or after use of an VPN. For example ls or git status commands took over a minute to complete!

Observations

During this slow pace if network is turned off, then git-bash works normally.

Git for Windows uses __git_ps1 internally for getting some info and that alone takes over a minute!

@lehtu
lehtu / partial-command-history-guide-for-git-bash.md
Created December 22, 2022 12:16
How to enable partial command history for Git Bash aka Git for windows

Partial Command History for Git BASH

Partial Command History is pretty basic in any *NIX system, but for some reason in Git BASH it's not a default.

What does partial command history mean?

This means that when you type partial command in bash and use arrow up/down keys, it goes through only those commands starting with what you have already typed.

How to:

In your ~/.inputrc file you just need to add key bindings:

@lehtu
lehtu / LEMP SERVER on Ubuntu 14.04.md
Last active December 13, 2017 21:45 — forked from milon/LEMP SERVER on Ubuntu 14.04.md
Installing LEMP Server on Ubuntu 14.04

LEMP Server on Ubuntu 14.04

For detail look here

Update timezone

sudo dpkg-reconfigure tzdata

Add user and prevent root login

@lehtu
lehtu / how-to-lint-staged-files-on-commit.md
Last active August 3, 2017 10:49
Here is how-to guide for linting staged files while trying to commit

How to setup linting in pre-commit (only for staged files)

First we need to get list of staged files.

git status -s -uno

Then we want to limit it only to list of files.

git status -s -uno | grep -o -e '[a-zA-Z0-9_.-]*.js'
@lehtu
lehtu / .npmignore
Created August 2, 2017 07:29
ignore file for npmjs.org packages
*.swp
*~
*.iml
.*.haste_cache.*
.DS_Store
.idea
.babelrc
.eslintrc
npm-debug.log
lib
@lehtu
lehtu / how-to-setup-eslint-for-meteor.md
Last active October 17, 2023 06:07
How to setup eslint for Meteor project

How to setup eslint for Meteor project

Usage

  • install dependencies
  • setup .eslintrc to the root of your project
  • run eslint .

Dependencies

Install all needed dependencies

@lehtu
lehtu / .eslintrc.json.md
Last active March 12, 2017 00:28
.eslintrc.json for Meteor projects
{
    "extends": [
      "airbnb",
      "plugin:meteor/recommended"
    ],
    "plugins": [
        "import",
        "meteor"
 ],

Counts how many items exists in db.orders.products array.

Inside aggregate query you only need to chance $products to be the property which contains an array

db.orders.aggregate([{$project: {item: 1, bookings: {$size:"$products"}}}])
@lehtu
lehtu / weekly-recurring-event-date-calculator.js
Last active November 9, 2016 22:05
Calculates all dates between input dates and gives dates every week for the week day by start date.
// working demo in here: https://jsfiddle.net/lehtu/awnuk9f1/
var moment = require('moment');
var start = '2016-01-01';
var end = '2016-12-31';
var weeks = moment(end).diff(start, 'week');
var dates = [];
for (var i = 0; i <= weeks; i++) {
@lehtu
lehtu / 0_reuse_code.js
Created October 6, 2015 13:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console