Skip to content

Instantly share code, notes, and snippets.

@prenaux
prenaux / pr.md
Last active August 29, 2015 14:27 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@prenaux
prenaux / postgres-cheatsheet.md
Last active August 29, 2015 14:27 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

Magic words:

psql -U postgres

Most \d commands support additional param of __schema__.name__ and accept wildcards like *.*

  • \q: Quit/Exit
  • \c __database__: Connect to a database
  • \d __table__: Show table definition including triggers
@prenaux
prenaux / MagicMove.jsx
Created August 30, 2015 06:55
An updated MagicMove.jsx, faster than react-shuffle, but has issues with overlays and resizing, atm I'm using react-shuffle because of that.
var React = require('react');
var cloneWithProps = require('react/lib/cloneWithProps');
var Clones = React.createClass({
displayName: 'MagicMoveClones',
propTypes: {
children: React.PropTypes.node,
},
@prenaux
prenaux / sensible-defaults.css
Created June 2, 2018 12:15 — forked from cesarandreu/sensible-defaults.css
Sensible css defaults taken from css-layout
div, span {
box-sizing: border-box;
position: relative;
display: flex;
flex-direction: column;
align-items: stretch;
flex-shrink: 0;
align-content: flex-start;
@prenaux
prenaux / dot-emacs.el
Created August 30, 2018 04:43
Polyglot mode for Emacs
(autoload 'polyglot-mode "polyglot-mode" nil t)
(add-to-list 'auto-mode-alist '("\\.polyglot\\'" . polyglot-mode))
(add-to-list 'auto-mode-alist '("\\.productions\\'" . polyglot-mode))
(add-to-list 'auto-mode-alist '("\\.sablecc\\'" . polyglot-mode))
#
# Sample configuration file for the Samba suite for Debian GNU/Linux.
#
#
# This is the main Samba configuration file. You should read the
# smb.conf(5) manual page in order to understand the options listed
# here. Samba has a huge number of configurable options most of which
# are not shown in this example
#
# Some options that are often worth tuning have been included as
@prenaux
prenaux / polyglot-mode.el
Created May 1, 2020 12:46
Super basic emacs mode for Polyglot/SableCC grammars
(defvar polyglot-mode-hook nil)
(defconst polyglot-mode-syntax-table
(let ((table (make-syntax-table)))
;; SableCC uses java-style comments.
;; Follows the C++ example in the major mode tutorial
;; //. /*...*/
(modify-syntax-entry ?/ ". 124b" table)
(modify-syntax-entry ?* ". 23" table)
(modify-syntax-entry ?\n "> b" table)
@prenaux
prenaux / add-alpine-js-to-tailwind-ui.js
Created March 18, 2022 11:02 — forked from KevinBatdorf/add-alpine-js-to-tailwind-ui.js
Auto copy the Alpine code from Tailwind UI's copy button
// ==UserScript==
// @name Add AlpineJs to Tailwind UI
// @namespace http://tampermonkey.net/
// @version 3.0
// @description Add Alpine JS code to Tailwind Ui copy/paste
// @author https://gist.github.com/KevinBatdorf/8bd5f808fff6a59e100dfa08a7431822
// @match https://tailwindui.com/components/*
// @grant none
// ==/UserScript==
@prenaux
prenaux / flecs_nilang_reflection_example.cpp
Created July 26, 2022 12:21
Flecs: Register niLang math types & component members for interop.
#define _TMEMBER(T,NAME) member<decltype(T::NAME)>(#NAME)
#define _MEMBER(NAME) member<decltype(NAME)>(#NAME)
void RegisterBaseTypes(flecs::world& aWorld) {
aWorld.component<sVec2f>()
._TMEMBER(sVec2f,x)
._TMEMBER(sVec2f,y);
aWorld.component<sVec3f>()
._TMEMBER(sVec3f,x)
._TMEMBER(sVec3f,y)
@prenaux
prenaux / msvc19_deadlock.cpp
Last active July 28, 2022 15:56
MSVC v19 optimiser freezes when compiling GetTrianglesIndices_MSVC19_Deadlock
//
// The MSVC 19 optimizer deadlocks when compiling GetTrianglesIndices_MSVC19_Deadlock.
// Tested on cl.exe v19.27.29112 & v19.29.30142.1
//
// See: https://godbolt.org/z/o8rWsWsbb
//
//! Get triangles indices.
//! \remark The array needs to have room for 36 elements.
static void GetTrianglesIndices_MSVC19_NoCrash(int* pIndices, bool bCW) {