Skip to content

Instantly share code, notes, and snippets.

@alexengrig
alexengrig / ParagraphReplacer.java
Last active May 4, 2024 13:12
Apache POI: Paragraph text replacer
import org.apache.poi.xwpf.usermodel.PositionInParagraph;
import org.apache.poi.xwpf.usermodel.TextSegment;
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
import org.apache.poi.xwpf.usermodel.XWPFRun;
import java.util.List;
import java.util.Objects;
import java.util.function.Function;
/**
@pmkay
pmkay / top-brew-packages.txt
Last active May 4, 2024 13:12 — forked from r5v9/top-brew-packages.txt
Top homebrew packages
node: Platform built on V8 to build network applications
git: Distributed revision control system
wget: Internet file retriever
yarn: JavaScript package manager
python3: Interpreted, interactive, object-oriented programming language
coreutils: GNU File, Shell, and Text utilities
pkg-config: Manage compile and link flags for libraries
chromedriver: Tool for automated testing of webapps across many browsers
awscli: Official Amazon AWS command-line interface
automake: Tool for generating GNU Standards-compliant Makefiles
@npaton
npaton / chat.js
Created February 28, 2024 00:14
Empirica 2 Javascript chat
import React, {
useEffect,
useRef,
useState,
} from "react";
import { usePlayer } from "@empirica/core/player/classic/react";
import { Loading } from "@empirica/core/player/react";
export function Chat({
scope,
@dvddarias
dvddarias / Arrows2DMovement.cs
Last active May 4, 2024 13:08
Unity editor script to precisely move, rotate and scale GameObjects on a 2D scene, using the arrow keys.
/*
Unity editor script to precisely move, rotate and scale GameObjects on 2D scenes, using the arrow keys.
Notes:
- To use it just include it on an "Assets/Editor" folder on your project.
- The action depends on the selected tool and the size of the movement depends on the Scene view zoom.
- The more "zoomed in" is the scene view the smaller is the movement step.
- It will work when the current Scene tab is in 2D mode and there is at least one gameObject selected,
otherwise the scene camera will move as usual :)
@squarism
squarism / iterm2.md
Last active May 4, 2024 13:06
An iTerm2 Cheatsheet

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key
Cycle iTerm Windows + backtick (true of all mac apps and works with desktops/mission control)
@Nikolaj-K
Nikolaj-K / category_theory_literature.md
Last active May 4, 2024 13:04
Recomended reading for the undergrad category theorist
@Hertzole
Hertzole / SceneObject.cs
Last active May 4, 2024 13:04
Unity scene object to easily assign scenes in the inspector.
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
[System.Serializable]
public class SceneObject
{
[SerializeField]
private string m_SceneName;
@Julian-Nash
Julian-Nash / flask_sitemap_generator.py
Last active May 4, 2024 13:03
Flask dynamic sitemap generator
@app.route("/sitemap")
@app.route("/sitemap/")
@app.route("/sitemap.xml")
def sitemap():
"""
Route to dynamically generate a sitemap of your website/application.
lastmod and priority tags omitted on static pages.
lastmod included on dynamic content such as blog posts.
"""
from flask import make_response, request, render_template
@panchalkalpesh
panchalkalpesh / git-aliases.md
Last active May 4, 2024 13:03 — forked from ypwu1/git-aliases.md
The Ultimate Git Alias Setup · GitHub

The Ultimate Git Alias Setup

If you use git on the command-line, you'll eventually find yourself wanting aliases for your most commonly-used commands. It's incredibly useful to be able to explore your repos with only a few keystrokes that eventually get hardcoded into muscle memory.

Some people don't add aliases because they don't want to have to adjust to not having them on a remote server. Personally, I find that having aliases doesn't mean I that forget the underlying commands, and aliases provide such a massive improvement to my workflow that it would be crazy not to have them.

The simplest way to add an alias for a specific git command is to use a standard bash alias.

# .bashrc
@Klerith
Klerith / index.ts
Last active May 4, 2024 13:02
Vuex + TypeScript - Store Structure Strongly Typed
import { createStore } from 'vuex';
// My custom modules
import exampleModule from './module-template';
import { ExampleStateInterface } from './module-template/state';
export interface StateInterface {
// Define your own store structure, using submodules if needed
// example: ExampleStateInterface;