Skip to content

Instantly share code, notes, and snippets.

View cassiozen's full-sized avatar
:atom:

Cassio Zen cassiozen

:atom:
View GitHub Profile
@cassiozen
cassiozen / NeuralNetwork.lua
Created July 17, 2014 20:05
Lua Neural Network
ACTIVATION_RESPONSE = 1
NeuralNetwork = {
transfer = function( x) return 1 / (1 + math.exp(-x / ACTIVATION_RESPONSE)) end --This is the Transfer function (in this case a sigmoid)
}
@cassiozen
cassiozen / pixelbook-dev-setup.md
Last active October 22, 2023 12:06 — forked from denolfe/pixelbook-linux-setup.md
Notes on setting up Pixelbook for development

Pixelbook Setup

Change your channel

Some of the features mentioned in this document only work on the beta or Dev channel. To change your channel:

  1. chrome://help in a browser window
  2. Click Detailed Build Information
  3. Change Channel
  4. Select Beta (Or Dev, if you're feeling adventurous)
@cassiozen
cassiozen / addPage.js
Last active November 21, 2022 17:14
Wikistack scaffolding Raw
const html = require("html-template-tag");
const layout = require("./layout");
module.exports = () => layout(html`
<h3>Add a Page</h3>
<hr>
<form method="POST" action="/wiki/">
<div>PLACEHOLDER FOR AUTHOR NAME FIELD</div>
@cassiozen
cassiozen / TypeUtilities.ts
Created September 19, 2022 17:51
Typescript Type Utilities (by https://github.com/devanshj)
export namespace TypeUtils {
/**
* Casts a type (unless it's already narrower)
* @example
* // returns 'hey'
* Cast<'hey', string>
* @example
* // returns string
* Cast<unknown, string>
*/
module.exports.requestUploadURL = (event, context, callback) => {
var s3 = new AWS.S3();
var params = JSON.parse(event.body);
var s3Params = {
Bucket: 'slsupload',
Key: params.name,
ContentType: params.type,
ACL: 'public-read',
};
body {
border: none !important;
}
.kineticjs-content {
background-color: #282c34;
}
td {
background-color: #282c34;
@cassiozen
cassiozen / debugging.md
Last active February 3, 2022 01:43 — forked from glebec/debugging.md
Debugging

Debugging JavaScript Applications

A practical distillation for Fullstack Academy students

Faults in computer problems were theorized as far back as 1843, when Ada Lovelace noted of Babbage's Analytical Engine, "Granted that the actual mechanism is unerring in its processes, the cards may give it wrong orders." Almost 160 years later, NIST reported that software errors cost the US $59 billion annually. Clearly, some of the cards are wrong. However, unlike Grace Hopper's famous moth, most of the time the culprit is ourselves.

Debugging is a sanitization procedure consisting of:

  • Preventing bugs in the first place, through good practices and assistive tooling.
  • Detecting bugs when they first arise, through proper error handling and testing.
import React, { createContext, Fragment, useEffect, useState } from 'react';
import PropTypes from 'prop-types';
function MyComponent({ name, show }: { name: string; show: boolean }) {
const [isEnabled, setIsEnabled] = useState<boolean>(false);
return (
<Fragment>
<p>hi {show ? name : 'stranger'}</p>
</Fragment>
);
<!DOCTYPE html>
<html lang="en">
<head>
<title>A File Upload Demo</title>
<style>
html, body {
height: 100%;
margin: 0;
}
body {
atom-text-editor {
-webkit-font-smoothing: antialiased;
}
atom-text-editor::shadow{
.storage.type.function.arrow, .operator {
font-family: 'FiraCode-Retina';
text-rendering: optimizeLegibility;
vertical-align: baseline;
}