This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.IO; | |
| namespace rename | |
| { | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| var subfolderName = args?.Length > 0 ? args[0] : Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import path from 'path' | |
| const flatten = function(destFolder) { | |
| return function(file) { | |
| file.path = file.base + path.basename(file.path) | |
| return destFolder | |
| } | |
| } | |
| //usage |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # find apache config file location | |
| apache2 -V | grep 'HTTPD_ROOT\|SERVER_CONFIG_FILE' | |
| # list top level global npm packages | |
| npm -g ls --depth=0 | |
| # remove long path folder | |
| rmdir node_modules /s /q | |
| # windows: switch cmdline to run as Admin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| terraform_upgrade() { | |
| OS_NAME="darwin" | |
| if [[ "$OSTYPE" == "linux"* ]]; then | |
| OS_NAME="linux" | |
| fi | |
| TEMP_PATH="/tmp" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # grab all resources that will be marked for deletion and has [prefix]_[name].[suffix] template | |
| # change module.name with yours naming | |
| terraform plan -no-color awk '$1 == "-" && $2 ~ /.*_.*\..*/ { print "terraform state mv " $2 " module.name." $2 }' > mv_state.sh | |
| # apply state changes | |
| ./mv_state.sh | |
| # remove backups after checking state | |
| rm -f terraform.tfstate.* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| git remote add -f js-tests git@github.com:cambridgebrainsciences/js-tests.git | |
| git merge --no-commit -s ours js-tests/master | |
| git read-tree --prefix=frontend/tests -u js-tests/master | |
| git commit -m "Subtree merged in frontend/tests" | |
| git remote remove js-tests |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # optionally set editor to the modern https://github.com/zyedidia/micro editor | |
| git config --global core.editor micro | |
| # find next commit after common commit of the long running side branches | |
| COMMON_COMMIT="$(git merge-base long-running-feature-branch feature-branch-development)" | |
| # get next to common commit | |
| git log --pretty=format:"%h" "$COMMON_COMMIT...feature-branch-development" | tail -n1 | |
| > 50b1ed6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import orm from 'schema/orm' | |
| export function loadStateReducer(state = orm.getEmptyState(), payload) { | |
| // Create a Redux-ORM session from our entities "tables" | |
| const session = orm.session(state) | |
| const parseEntity = (modelName, stateSlotName) => { | |
| const ModelClass = session[modelName] | |
| const modelStates = payload.entities[stateSlotName] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # https://hackernoon.com/get-unused-routes-of-large-rails-app-0h1cu32lj | |
| Rails.application.eager_load! | |
| unused_routes = {} | |
| # Iterating over all non-empty routes from RouteSet | |
| Rails.application.routes.routes.map(&:requirements).reject(&:empty?).each do |route| | |
| name = route[:controller].camelcase | |
| next if name.start_with?("Rails") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| HOST=0.0.0.0 | |
| PROXY=http://localhost:3001 |