Skip to content

Instantly share code, notes, and snippets.

@rom3r4
rom3r4 / rails_generator_cheat_sheet.md
Created August 4, 2023 22:00 — forked from cdesch/rails_generator_cheat_sheet.md
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.

@rom3r4
rom3r4 / wget-exit-codes.txt
Created April 22, 2023 21:24 — forked from cosimo/wget-exit-codes.txt
wget exit codes
This is the list of exit codes for wget:
0 No problems occurred
1 Generic error code
2 Parse error — for instance, when parsing command-line options, the .wgetrc or .netrc…
3 File I/O error
4 Network failure
5 SSL verification failure
6 Username/password authentication failure
7 Protocol errors
@rom3r4
rom3r4 / nexus-uploader.py
Created April 5, 2023 16:21 — forked from omnisis/nexus-uploader.py
Uploads a local M2 repo to a remote Nexus Server
#!/usr/bin/env python
""""
nexus-uploader.py
Allows mirroring local M2 repositories to a remote Nexus server with a single command.
Supports:
- uploading of common classifiers (sources, javadocs) if available
- using regex include pattern for artifactIds/groupIds
- recursively processing local repo, just point to the root
@rom3r4
rom3r4 / clone.bash
Created March 1, 2023 21:13 — forked from milanboers/clone.bash
Clone all repositories of a Github user
curl -s https://api.github.com/users/milanboers/repos | grep \"clone_url\" | awk '{print $2}' | sed -e 's/"//g' -e 's/,//g' | xargs -n1 git clone
#!/bin/bash
CF=~/.git-dprz.sh
function info {
cat <<- INFO
-- Script for downloading PRIVATE(!) git-repos as tar-archive on old systems (like Debian Etch)
-- That only have old git - binaries
--
@rom3r4
rom3r4 / getMyCode.js
Created March 1, 2023 21:03 — forked from creationix/getMyCode.js
Script to download all repos for a user
// Run this with node and then run the output with sh
var Http = require('http')
var ChildProcess = require('child_process');
Http.cat("http://github.com/api/v2/json/repos/show/creationix", function (err, json) {
if (err) throw err;
var data = JSON.parse(json);
data.repositories.forEach(function (repo) {
console.log("echo " + JSON.stringify(repo.name + " - " + repo.description));
console.log("git clone --bare " + repo.url);
});
@rom3r4
rom3r4 / install-wget2
Last active September 28, 2022 11:52 — forked from davdenic/install-wget2
Install wget2 on macos
wget https://gnuwget.gitlab.io/wget2/wget2-latest.tar.gz
tar xf wget2-latest.tar.gz
cd wget2-*
brew install automake gettext lzip pkg-config xz gnutls
brew link --force gettext
./configure
make
make check
sudo make install
@rom3r4
rom3r4 / gist:ed1678ac7881cc9b09973f887823bea3
Created January 16, 2022 02:32 — forked from voldy/gist:3699664
Ruby on Rails best practices

Ruby on Rails best practices

Code style

  • Use UTF-8. It’s 21 century, 8bit encodings dead now.
  • Use 2 space indent, not tabs
  • Use Unix-style line endings
  • Keep lines not longer than 80 chars
  • Remove trailing whitespace
@rom3r4
rom3r4 / TestUtil.java
Created November 25, 2021 11:50
TestUtil.java
package com.mycompany.myapp.web.rest;
import static org.assertj.core.api.Assertions.assertThat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import java.io.IOException;
import java.math.BigDecimal;
/**
* Jest Conversion script
* This script isn't the cleanest, and uses two different methods for performing global replaces... but it gets the job done.
* We switched from using the `replace` method to the `advancedReplace` about 70% of the way through, and couldn't go and retrofit
* `advancedReplace` everywhere with 100% confidence. However, should you use this script as a base for your own migration,
* I would definitely suggest using `advancedReplace`, which uses the node-replace library.
*/
import {sync as globSync} from 'glob'
import {execSync} from 'child_process'
import fs from 'fs'