Skip to content

Instantly share code, notes, and snippets.

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

#!/bin/bash
#
# =========================================================================
# Copyright 2014 Rado Buransky, Dominion Marine Media
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@lucasviola
lucasviola / gulpfile.js
Created September 22, 2015 17:13 — forked from danharper/gulpfile.js
New ES6 project with Babel, Browserify & Gulp
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var browserify = require('browserify');
var watchify = require('watchify');
var babel = require('babelify');
function compile(watch) {
var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel));
@lucasviola
lucasviola / gist:27386405475c17db7433
Created October 22, 2015 05:22 — forked from JosephPecoraro/shell-execution.rb
Shell Execution in Ruby
# Ways to execute a shell script in Ruby
# Example Script - Joseph Pecoraro
cmd = "echo 'hi'" # Sample string that can be used
# 1. Kernel#` - commonly called backticks - `cmd`
# This is like many other languages, including bash, PHP, and Perl
# Returns the result of the shell command
# Docs: http://ruby-doc.org/core/classes/Kernel.html#M001111
function processData(input) {
var lines = input.split('\n');
lines.forEach(function(line, i){
if(i > 0 && i % 2 == 0){ //pra que isso?
var list = line.split(' ').map(function(x){ return parseInt(x)});
if(list.length > 1){
var fuckYeah = false;
var slicedSumLeft = 0;
var slicedSumRight = list.reduce(function(a,b){ return a+b }) - list[0]; // Que que faz esse reduce? Soma a parte da direita, tá bem óbvio, mas não consegui implementar em sintaxe de java 7
function unNestArray (nestedArray) {
var unnestedArray = [];
unnestedArray.push(nestedArray);
nestedArray.forEach(function (node) {
if (node instanceof Array) {
unNestArray(node, nestedArray);
}
});
#!/bin/bash
RED=$(tput setaf 1) # Just so the error message is red
regex="Generate a regex that matches the criteria" #regex for validation goes here
MESSAGE=$(echo "You need to find a way to get the message. I think pre-message or commit-message")
if ! [[ $MESSAGE =~ $regex ]]; then
#!/bin/bash
RED=$(tput setaf 1) # Just so the error message is red
regex="Generate a regex that matches the criteria" #regex for validation goes here
MESSAGE=$(echo "You need to find a way to get the message. I think pre-message or commit-message")
if ! [[ $MESSAGE =~ $regex ]]; then
#!/usr/bin/env ruby
# utf:8
message_file = ARGV[0]
message = File.read(message_file)
$regex = /(#\d+):/
if !$regex.match(message)
puts "\n"
puts "\n"
/**
* Método para somar o valor de A com o valor de B.<br>
* Exemplo de uso deste método:<br>
* <pre>
* int a = 5;
* int b = 3;
* int soma = somaAB(a, b);
* </pre>
* No exemplo supracitado, a variável <code>soma</code> conterá
* o valor da soma das variáveis <code>a</code> e <code>b</code>.