Skip to content

Instantly share code, notes, and snippets.

View gnclmorais's full-sized avatar
🐙
Growing a beard

Gonçalo Morais gnclmorais

🐙
Growing a beard
View GitHub Profile
@gnclmorais
gnclmorais / controllers.application\.js
Created November 25, 2022 14:19
Indeterminate demo
import Controller from '@ember/controller';
import { tracked } from '@glimmer/tracking';
export default class ApplicationController extends Controller {
@tracked isChecked = false;
@tracked isIndeterminate = false;
cycle = () => {
if (this.isChecked) {
this.isChecked = false;
@gnclmorais
gnclmorais / components.my-checkbox\.js
Last active April 8, 2022 14:42
Checkbox with multiple args
import Component from '@glimmer/component';
import { action } from '@ember/object';
export default class extends Component {
@action
selectProduct({ id, checked }) {
console.log({ id, checked });
}
}
@gnclmorais
gnclmorais / c-cedilla.md
Last active February 17, 2022 08:34
How to write the letter ç (c-cedilla) in virtually everywhere.

Writing cursive forms of Ç, from Wikipedia

Character macOS (UK) Unicode Alt Code HTML (Name) HTML (Number)
Upper case Ç + + c U+00C7 Alt 0199 Ç Ç
Lower case ç + c U+00E7 Alt 0231 ç ç

On Linux, you can use Ctrl + Shift + u followed by the code in hex/unicode (you only need to hold down Ctrl and Shift while typing the code).


@gnclmorais
gnclmorais / keybase.md
Created May 13, 2021 14:42
keybase.md

Keybase proof

I hereby claim:

  • I am gnclmorais on github.
  • I am gnclmorais (https://keybase.io/gnclmorais) on keybase.
  • I have a public key ASCSdjucny8qcjDql7Lcw91lxP6wl4E07jCdw1jIEG7hYgo

To claim this, I am signing this object:

@gnclmorais
gnclmorais / flatter.js
Last active August 29, 2017 15:25
Iterate over a matrix in JavaScript, cell by cell
function* flatten(matrix) {
for (var i = 0; i < matrix.length; i += 1) {
let column = matrix[i];
if (!Array.isArray(column)) yield column;
for (var j = 0; j < column.length; j += 1) {
yield column[j];
}
}
@gnclmorais
gnclmorais / 80_char_limit.commented.css
Last active July 5, 2017 17:07
CSS-only ruler for GitHub diff
.code-review::after {
/** Make the pseudo-element visible: */
content: '';
/** Replicate the font style the <td> element is using: */
font-size: 12px;
font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
/** Replicate the left padding the <td> element has: */
margin-left: 10px;
/** Setup actual positioning of the element: */
position: absolute;
@gnclmorais
gnclmorais / iterm2_toggle.sh
Created July 27, 2014 11:18
Add/remove iTerm 2 from OS X’s dock
#Remove iTerm 2 from the dock
/usr/libexec/PlistBuddy -c 'Add :LSUIElement bool true' /Applications/iTerm\ 2.app/Contents/Info.plist
#Restore iTerm 2 to the dock
/usr/libexec/PlistBuddy -c 'Delete :LSUIElement' /Applications/iTerm\ 2.app/Contents/Info.plist
@gnclmorais
gnclmorais / mov2gif.md
Last active February 9, 2016 10:48
OS X Screencast to animated GIF

Overview

Following this gist, I decided to create my own tutorial/manual for future reference.

Prerequisites

Before trying to convert anything, you must have the following tools installed:

  • QuickTime (to record the video)
  • ffmpeg (to process the video file)
  • gifsicle (to create and optimise the animated gif)

Instalation

@gnclmorais
gnclmorais / type.js
Created December 3, 2013 15:19 — forked from jonbretman/type.js
(function (root) {
var type = function (o) {
// handle null in old IE
if (o === null) {
return 'null';
}
// handle DOM elements