Skip to content

Instantly share code, notes, and snippets.

View FernandoBasso's full-sized avatar

Fernando Basso FernandoBasso

View GitHub Profile
@FernandoBasso
FernandoBasso / function-exression-ES5-vs-ES6.js
Created January 25, 2016 12:25
Using () to force a IIFE in ES5 functions vs in ES6 arrow functions
var l = console.log.bind(console);
// ↓
var jedi1 = ((name, skill) => ({
name: name,
skill: skill
}))('Master Yoda', 'The Force') ;
//↑ ↑ Can't close ) at the end.
l(jedi1.name);
l(jedi1.skill);
@FernandoBasso
FernandoBasso / sed-reverse-lines.txt
Created March 14, 2016 23:43
Trying to understand how "reverse lines" in sed works
file:
AA
BB
CC
DD
sed command:

He who knows not and knows not he knows not, He is a fool - Shun him.

He who knows not and knows he knows not, He is simple - Teach him.

He who knows and knows not he knows, he is asleep - Awaken him.

He who knows and knows that he knows, He is wise - Follow him.

<?php
class Person {
private $name;
public function __construct($name = '') {
$this->name = $name;
}
@FernandoBasso
FernandoBasso / pdotransaction.php
Created May 19, 2016 19:10
Example of PDO transaction with insertion in two tables and a loop on the second one.
<?php
public function salvaPedidoDb() {
try {
$this->db->beginTransaction();
$sql1 = 'INSERT INTO pedidos (pessoa_fk, preco_total) VALUES (:pessoa_fk, :preco_total)';
$sth1 = $this->db->prepare($sql1);
#!/usr/bin/env bash
#tmux new-session -d -s rails 'title rails-development; stty -ixon; vim'
cd ~/develop/projs/html5-audio-player-typescript
title oswp
tmux new-session -d -s oswp
# For some reason, send-keys does nothing here, not even an error is displayed.
━━━━━━━━━━━━━━━━
HASKELL-NOTES1
Fernando Basso
━━━━━━━━━━━━━━━━
Table of Contents
─────────────────

In haskell, `div` is integer only division. code is nice, see?

@FernandoBasso
FernandoBasso / emacs-finding-help.txt
Last active August 11, 2016 20:10
Tips and a summary of most common and useful commands for finding help in Emacs.
━━━━━━━━━━━━━━━━
EMACS SUMMARY
Fernando Basso
━━━━━━━━━━━━━━━━
Table of Contents
─────────────────
@FernandoBasso
FernandoBasso / emacs-lisp-toggle-org-emph.el
Created August 13, 2016 14:27
oggles showing of org mode markup like ~, /, * etc.
(defun my/toggle-org-emph ()
"Toggles showing of org mode markup like ~, /, * etc."
(interactive)
(when (eq major-mode 'org-mode)
(if (and org-hide-emphasis-markers)
(progn
(print "Hiding org-mode emphasis markers")
(setq org-hide-emphasis-markers nil)
(org-mode))
(progn