Skip to content

Instantly share code, notes, and snippets.

@alejzeis
alejzeis / timezone-mappings.csv
Created March 15, 2017 00:12
Linux-Windows Timezone Mappings CSV
AUS Central Standard Time 001 Australia/Darwin
AUS Central Standard Time AU Australia/Darwin
AUS Eastern Standard Time 001 Australia/Sydney
AUS Eastern Standard Time AU Australia/Sydney Australia/Melbourne
Afghanistan Standard Time 001 Asia/Kabul
Afghanistan Standard Time AF Asia/Kabul
Alaskan Standard Time 001 America/Anchorage
Alaskan Standard Time US America/Anchorage America/Juneau America/Metlakatla America/Nome America/Sitka America/Yakutat
Aleutian Standard Time 001 America/Adak
Aleutian Standard Time US America/Adak
@wojteklu
wojteklu / clean_code.md
Last active May 6, 2024 11:34
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@agramfort
agramfort / ranking.py
Created March 18, 2012 13:10 — forked from fabianp/ranking.py
Pairwise ranking using scikit-learn LinearSVC
"""
Implementation of pairwise ranking using scikit-learn LinearSVC
Reference: "Large Margin Rank Boundaries for Ordinal Regression", R. Herbrich,
T. Graepel, K. Obermayer.
Authors: Fabian Pedregosa <fabian@fseoane.net>
Alexandre Gramfort <alexandre.gramfort@inria.fr>
"""
@bennycode
bennycode / window-fetch-post.js
Created February 18, 2019 23:19
Send POST request in Google Chrome
// Using "var" here to easily change the parameters and resubmit the code in a JS dev console!
var url = 'http://127.0.0.1:3000/login';
var parameters = {
user: 'bennyn',
password: 'secret'
};
fetch(url, {
method: 'post',
@bennycode
bennycode / material-ui-tricks.md
Last active May 6, 2024 11:31
Material UI Tricks

Add class

  render(): JSX.Element {
    const {classes, title} = this.props;
    return (
      <>
         <TextField
           className={classes.TextField}
           ...
@bennycode
bennycode / stateful-copies.js
Created December 2, 2019 13:45
Stateful copies
const test = {
tree: {
branch1: 10,
branch2: 20,
}
};
const copies = {};
for (let i = 0; i < 10; i++) {
@bennycode
bennycode / absence-io-example.js
Created January 14, 2020 16:01
Hacky absence.io API example
const Hawk = require('@hapi/hawk');
const request = require('request');
const API_KEY = 'KEY';
const API_KEY_ID = 'ID';
const credentials = {
id: API_KEY_ID,
key: API_KEY,
algorithm: 'sha256'
@bennycode
bennycode / bluebird-promise-cancellation.js
Last active May 6, 2024 11:30
Bluebird Promise Cancellation
// Compliant Promise/A+ implementation: https://www.promisejs.org/implementing/
// Alternative implementation: https://dexie.org/docs/Promise/Promise
// Checkout the Node.js Event Loop: https://www.youtube.com/watch?v=PNa9OMajw9w
// Bluebird breaking change: http://bluebirdjs.com/docs/new-in-bluebird-3.html#cancellation-overhaul
const Promise = require('bluebird');
Promise.config({
cancellation: true,
});