Skip to content

Instantly share code, notes, and snippets.

Fernando Basso FernandoBasso

Block or report user

Report or block FernandoBasso

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@FernandoBasso
FernandoBasso / CategoryIndex.spec.js
Last active Jan 31, 2018
testing vuetify components
View CategoryIndex.spec.js
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 Jan 30, 2018
vuejs test emitted events with sinon spy
View Foo.spec.js
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', () => {
View the-little-schemer.scm
(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 Oct 18, 2017
Marvelous piece of javascript found in a legacy project I am maintaining
View brilliant.js
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;
}
}
}
View inclues-in-blade.blade.php
@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 Oct 15, 2017
catch not catching ...
View Admin.php
<?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 Oct 17, 2017
Find possible board combinations
View tic-tac-toe-possible-boards.rkt
#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.
View tic-tac-toe.txt
In this problem we want you to design a function that produces all
possible filled boards that are reachable from the current board.
In actual tic-tac-toe, O and X alternate playing. For this problem
you can disregard that. You can also assume that the players keep
placing Xs and Os after someone has won. This means that boards that
are completely filled with X, for example, are valid.
NOTE: It was said that there would be 512 possible filled in boards
following the description above.
@FernandoBasso
FernandoBasso / combine-trees-abstractions.rkt
Created Sep 16, 2017
Exercise from EDX course How to Code.
View combine-trees-abstractions.rkt
;; #lang htdp/isl
(require 2htdp/image)
(define-struct dir (name sub-dirs images))
;; Dir is (make-dir String ListOfDir ListOfImage)
;; interp. An directory in the organizer, with a name, a list
;; of sub-dirs and a list of images.
(define I1 (square 10 "solid" "red"))
(define I2 (square 12 "solid" "green"))
@FernandoBasso
FernandoBasso / lists.rkt
Created Jul 14, 2017
Produce lists in increasing number of items from input list.
View lists.rkt
(define (defsep los)
(if (empty? (rest los))
""
", "))
(define (concat los)
(cond [(empty? los) ""]
[else
(string-append (first los)
You can’t perform that action at this time.