Skip to content

Instantly share code, notes, and snippets.

View macku's full-sized avatar
:bowtie:
NaN, null, undefined

Maciej Adamczak macku

:bowtie:
NaN, null, undefined
View GitHub Profile
@robmiller
robmiller / git-cleanup-repo
Last active February 27, 2024 10:09
A script for cleaning up Git repositories; it deletes branches that are fully merged into `origin/master`, prunes obsolete remote tracking branches, and as an added bonus will replicate these changes on the remote.
#!/bin/bash
# git-cleanup-repo
#
# Author: Rob Miller <rob@bigfish.co.uk>
# Adapted from the original by Yorick Sijsling
git checkout master &> /dev/null
# Make sure we're working with the most up-to-date version of master.
git fetch
@mmacedo
mmacedo / source.fish
Last active August 9, 2017 04:49
Source bash/zsh/ksh files
function _exec_with
set -l shell $argv[1]
set -l file $argv[2]
set -l code $argv[3]
set -l source
switch "$shell"
case bash zsh ksh
set source .
case '*'
@ravihara
ravihara / jjs-require.js
Created January 13, 2016 13:23
CommonJS require function implementation for Nashorn / Java8
// Based on https://github.com/nodyn/jvm-npm
"use strict";
(function() {
var System = java.lang.System,
File = java.io.File,
FileInputStream = java.io.FileInputStream,
StringBuilder = java.lang.StringBuilder,
BufferedReader = java.io.BufferedReader,
InputStreamReader = java.io.InputStreamReader;
@shannonmoeller
shannonmoeller / multiline-regexp.js
Last active April 12, 2021 22:16
Multiline Regular Expressions using ES6 Template Strings
/**
* Inspired by XRegExp via 2ality
* http://www.2ality.com/2012/12/template-strings-xregexp.html
* http://xregexp.com/
*/
import test from 'ava';
export function rx(flags) {
const trailingComments = /\s+#.*$/gm;
@Twipped
Twipped / gulpfile.js
Last active July 22, 2019 15:22
CSS Modules without webpack or browserify
var gulp = require('gulp');
var gutil = require('gulp-util');
var through = require('through2');
var sourcemaps = require('gulp-sourcemaps');
var postcss = require('gulp-postcss');
var filter = require('gulp-filter');
var concat = require('gulp-concat');
var modules = require('postcss-modules');
@developit
developit / example.js
Last active May 6, 2024 05:10
Preact + Web Components = <333 Demo: http://www.webpackbin.com/VJyU9wK5W
import { h, Component } from 'preact';
import Markup from 'preact-markup';
import register from './preact-custom-element';
// just a proxy component: WC -> Preact -> WC
const A = () => <x-b foo="initial foo from <x-a>" />;
// stateful component that can re-render
class B extends Component {
render(props, state) {
@treshugart
treshugart / example.jsx
Last active May 6, 2024 04:53
Give yourself full control over the DOM that any hyperscript VDOM style function creates http://www.webpackbin.com/4kR0ZnXFf
import hify from './create-element';
import React from 'react';
import { render } from 'react-dom';
const h = hify(React.createElement.bind(React));
class Test extends HTMLElement {
static observedAttributes = ['attr']
attributeChangedCallback (name, oldValue, newValue) {
this.innerHTML = `Hello, ${this.getAttribute('attr')}!`;
@surma
surma / importPolyfill.js
Created May 6, 2017 17:17
Polyfill for dynamic module loading
_registry = {};
importPolyfill = path => {
if(!(path in _registry)) {
const entry = _registry[path] = {};
entry.promise = new Promise(resolve => entry.resolve = resolve);
document.head.appendChild(Object.assign(
document.createElement('script'),
{
type: 'module',
innerText: `import * as X from '${path}'; _registry['${path}'].resolve(X);`,
@vamsiampolu
vamsiampolu / callingChildComponentInRender.js
Last active August 7, 2018 15:11 — forked from coryhouse/callingChildComponentInRender.js
Example of calling extracted child component in render to avoid binding or declaring an arrow function
import React from 'react';
import UserListItem from './UserListItem';
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
users: [
{ id: 1, name: 'Cory' },
{ id: 2, name: 'Meg' }
@troyfontaine
troyfontaine / 1-setup.md
Last active October 15, 2024 12:33
Signing your Git Commits on MacOS

Methods of Signing Git Commits on MacOS

Last updated March 13, 2024

This Gist explains how to sign commits using gpg in a step-by-step fashion. Previously, krypt.co was heavily mentioned, but I've only recently learned they were acquired by Akamai and no longer update their previous free products. Those mentions have been removed.

Additionally, 1Password now supports signing Git commits with SSH keys and makes it pretty easy-plus you can easily configure Git Tower to use it for both signing and ssh.

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing your commits with GPG.