Skip to content

Instantly share code, notes, and snippets.

;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun enable-minor-mode (my-pair)
"Enable minor mode if filename match the regexp. MY-PAIR is a cons cell (regexp . minor-mode)."
(if (buffer-file-name)
(if (string-match (car my-pair) buffer-file-name)
(funcall (cdr my-pair)))))
@bmartel
bmartel / i3.config
Last active January 17, 2019 03:54
i3 config
# i3 config file (v4)
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
# Set mod key (Mod1=<Alt>, Mod4=<Super>)
set $mod Mod4
# set default desktop layout (default is tiling)
# workspace_layout tabbed <stacking|tabbed>
# Configure border style <normal|1pixel|pixel xx|none|pixel>
@bmartel
bmartel / spacemacs-cheshe.md
Created June 5, 2018 01:23 — forked from robphoenix/spacemacs-cheshe.md
Spacemacs Cheat Sheet

Useful Spacemacs commands

  • SPC q q - quit
  • SPC w / - split window vertically
  • SPC w - - split window horizontally
  • SPC 1 - switch to window 1
  • SPC 2 - switch to window 2
  • SPC w c - delete current window
  • SPC TAB - switch to previous buffer
  • SPC b b - switch buffers
@bmartel
bmartel / prepare-commit-msg.sh
Last active March 29, 2018 15:44 — forked from bartoszmajsak/prepare-commit-msg.sh
How to automatically prepend git commit with an issue id extracted from a branch name
#!/bin/bash
# Skip prepending certain branches
if [ -z "$BRANCHES_TO_SKIP" ]; then
BRANCHES_TO_SKIP=(master develop test)
fi
# Extract issue id from branch name
BRANCH_NAME=$(git symbolic-ref --short HEAD)
BRANCH_NAME=$(echo "${BRANCH_NAME##*/}" | sed 's/\([a-zA-Z]\{3,\}-[0-9]\{3,\}\).*/\1/')
alias dsc='docker stop $(docker ps -a -q)'
alias drc='docker rm $(docker ps -a -q)'
alias dri='docker rmi $(docker images -q)'
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
'.source.js':
'Mithril Component':
'prefix': 'mc'
'description': 'Create a new Mithril Component'
'body': """
import m from 'mithril';
const $1 = {
controller(props) {
$2
import m from 'mithril';
import Form from './form';
const Profile = {
controller(props) {
const profile = {
username: m.prop('bob'),
password: m.prop(''),
displayEmail: m.prop(false),
import m from 'mithril';
import { map } from 'lodash';
const Formatter = {
'float': (val, opts) => {
val = +val || 0;
if (opts) {
val = val.toFixed(opts);
}
return parseFloat(val);
import m from 'mithril';
let routes = {
// key
// path
// component
};
// Compile routes to mithril router format
export default function router(mountTarget, basePath='/', routeMode='hash') {