Skip to content

Instantly share code, notes, and snippets.

import axios from 'axios'
import jsifyKeysDeep from 'jsify-case-keys-deep' // Like `camelcase-keys-deep` but also transforms suffix '?' with prefix `is`
import decamelizeKeysDeep from 'decamelize-keys-deep'
import Qs from 'qs'
export default (baseURL) => {
const axiosClient = axios.create({
baseURL,
responseType: 'json',
})
@cdesch
cdesch / rails_generator_cheat_sheet.md
Last active May 15, 2024 13:40
Rails Generator CheatSheet

Cheat Sheets are greate but they are not a substitute for learning the framework and reading the documentation as we most certainly have not covered every potential example here. Please refer to the Rails Command Line Docs for more information.

Command Line Generator Info

Reference

You can get all of this information on the command line.

rails generate with no generator name will output a list of all available generators and some information about global options. rails generate GENERATOR --help will list the options that can be passed to the specified generator.

@nma
nma / windowsize.js
Created February 22, 2017 21:31
ReactJS get window sizes
constructor(props) {
super(props);
this.state = { height: 512 };
this.updateWindowDimensions = this.updateWindowDimensions.bind(this);
}
componentDidMount() {
this.updateWindowDimensions();
window.addEventListener("resize", this.updateWindowDimensions.bind(this));
}
@naxoc
naxoc / unused-images.sh
Created October 28, 2013 20:14
Script that looks at all images in a given location and checks if there are any references to each image. Useful for checking if images are being used by CSS for instance.
#!/bin/bash
DIR=.
if [ -n "$1" ]
then
DIR=$1
fi
# Find image files in.
FILES=`find $DIR -type f | grep ".*\.\(jpg\|gif\|png\|jpeg\)"`
@bartoszmajsak
bartoszmajsak / prepare-commit-msg.sh
Last active March 20, 2024 08:12
How to automatically prepend git commit with a branch name
#!/bin/bash
# This way you can customize which branches should be skipped when
# prepending commit message.
if [ -z "$BRANCHES_TO_SKIP" ]; then
BRANCHES_TO_SKIP=(master develop test)
fi
BRANCH_NAME=$(git symbolic-ref --short HEAD)
BRANCH_NAME="${BRANCH_NAME##*/}"
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Created: 2010/12/05
// Updated: 2018/09/12
// License: MIT
//
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it)
//