Skip to content

Instantly share code, notes, and snippets.

View FernandoBasso's full-sized avatar

Fernando Basso FernandoBasso

View GitHub Profile
@FernandoBasso
FernandoBasso / reading-info-man-pages.md
Last active April 26, 2018 09:01
Reading info and man pages

reading man and info pages

Created Sunday 08 April 2018

intro - man, help, info

Always read man pages, help pages, and info pages.

TIP: If you are new to *nix, don't expect to understand very much of the manuals when reading and trying stuff in the very first few attempts. It will really depend a lot on your background.

@FernandoBasso
FernandoBasso / parsing.py
Created April 19, 2018 10:56
python html.parser
class MyHTMLParser(HTMLParser):
def __init__(self):
HTMLParser.__init__(self)
self.isTags = False
self.tags = None
def handle_starttag(self, tag, attrs):
if tag == 'p':
if containsAttr(attrs, 'class', 'tags'):
self.isTags = True
@FernandoBasso
FernandoBasso / App.vue
Created February 10, 2018 13:33
App.vue
<template>
<v-app>
<v-navigation-drawer
app
clipped
fixed
v-model="drawer">
<v-list class="main-navigation-drawer">
@FernandoBasso
FernandoBasso / CategoryIndex.spec.js
Last active January 31, 2018 15:56
testing vuetify components
import { mount } from '@vue/test-utils';
import Vue from 'vue';
import CategoryIndex from '../../../src/components/CategoryIndex.vue';
describe('CategoryIndex', function () {
let wrp;
beforeEach(() => {
wrp = mount(CategoryIndex);
});
@FernandoBasso
FernandoBasso / Foo.spec.js
Created January 30, 2018 12:58
vuejs test emitted events with sinon spy
import Vue from 'vue';
import Foo from '../src/components/Foo.vue';
import expect from 'expect';
import sinon from 'sinon';
import { mount } from '@vue/test-utils';
// Can comment out the mocks property and use this. Both work.
// Vue.prototype.$ebus = new Vue();
describe('Foo', () => {
(require-extension test) ; chicken-install -s test
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Expr -> Bool
;; Takes an expression and produce #t if it is an atom; #f otherwise.
;;
;; NOTE:
;; Chicken has its own implementation of atom?. It produces
;; `#t` for '(). This version (from the book) produces #f for '().
@FernandoBasso
FernandoBasso / brilliant.js
Created October 18, 2017 15:58
Marvelous piece of javascript found in a legacy project I am maintaining
function foco(formulario){
elementos = document.getElementById(formulario).elements;
for (i=0; i<elementos.length; i++) {
if (elementos[i].hasAttribute("setFocus")) {
obr = elementos[i].getAttribute("type");
if(obr == "text") elementos[i].select(); else elementos[i].focus();
break;
}
}
}
@extends('admin.admin-layout')
@section('title', 'Cadastrar Nova Postagem')
@section('content')
<div class="crud posts edit">
{{-- This doesn't show up either if the Form is there --}}
what the fuck?
@FernandoBasso
FernandoBasso / Admin.php
Last active October 15, 2017 16:34
catch not catching ...
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Support\Facades\Auth;
<?php
class Admin
@FernandoBasso
FernandoBasso / tic-tac-toe-possible-boards.rkt
Last active October 17, 2017 12:51
Find possible board combinations
#lang htdp/isl+
;; Fetches `list-ref`, `take` and `drop`.
(require racket/list)
; PROBLEM 2:
;
; Below you will find some data definitions for a tic-tac-toe solver.
;
; In this problem we want you to design a function that produces all
; possible filled boards that are reachable from the current board.