Skip to content

Instantly share code, notes, and snippets.

View jamoroch's full-sized avatar

Juan Pablo Amorocho jamoroch

View GitHub Profile

git rebase -i <commit>^

choose edit

git reset HEAD^

edit

git add -p

@jamoroch
jamoroch / Copy files between git repos.md
Last active October 5, 2025 13:30
Copy files between git repos

git checkout A

git checkout B -- path/to/FileB1

What it does:

  • Fetches the FileB1 version from branch B and places it in the working directory.
  • Does not switch branches—you remain on the current branch (A).
  • Does not automatically stage or commit the file—you have to manually git add and git commit it. Source: ChatGPT
@jamoroch
jamoroch / Simple-Java-String-templating.md
Last active January 16, 2022 22:27
Simple Java String templating
import java.util.HashMap;
import java.util.Map;
import java.util.function.Supplier;

public class StringTemplateBuilder {
    private static final String DEFAULT_PLACEHOLDER_NOTATION = "${%s}";

    private final String template;
    private final Map<String, String> placeholders;

Pipeline version 1

pipeline {
  agent { label "linux" }
  stages {
    stage('Hello') {
      steps {
        sh '''
          aws --version
        '''
@jamoroch
jamoroch / express-server-side-rendering.md
Created June 7, 2021 16:42 — forked from joepie91/express-server-side-rendering.md
Rendering pages server-side with Express (and Pug)

Terminology

  • View: Also called a "template", a file that contains markup (like HTML) and optionally additional instructions on how to generate snippets of HTML, such as text interpolation, loops, conditionals, includes, and so on.
  • View engine: Also called a "template library" or "templater", ie. a library that implements view functionality, and potentially also a custom language for specifying it (like Pug does).
  • HTML templater: A template library that's designed specifically for generating HTML. It understands document structure and thus can provide useful advanced tools like mixins, as well as more secure output escaping (since it can determine the right escaping approach from the context in which a value is used), but it also means that the templater is not useful for anything other than HTML.
  • String-based templater: A template library that implements templating logic, but that has no understanding of the content it is generating - it simply concatenates together strings, potenti

Table definition

CREATE TABLE countries (
  id INT NOT NULL AUTO_INCREMENT,
  iso VARCHAR(2) NOT NULL,
  iso3 VARCHAR(3) NOT NULL,
  iso_numeric INT NOT NULL,
  country_name VARCHAR(64) NOT NULL,
 capital VARCHAR(64) NOT NULL,
@jamoroch
jamoroch / console-load-js-script.js
Created April 13, 2019 04:05 — forked from ducin/console-load-js-script.js
load js script from blank page browser (execute following code in the browser console)
(function(root){
root.getScript = function(url) {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = url;
document.head.appendChild(script);
}
}(window));
getScript('http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.js');