Skip to content

Instantly share code, notes, and snippets.

View twobitfool's full-sized avatar

Matt Smith twobitfool

View GitHub Profile

React Hooks Dangerous?

Before ranting about Hooks, here's a brief review of React's history...

Functional Components

In React, you can just use a plain function as a component. These are great for simple components that don't have any internal state.

@twobitfool
twobitfool / create-smartos-vm.sh
Last active May 28, 2023 01:51
Create a SmartOS VM in VirtualBox
#!/bin/sh
#
# Creates a SmartOS VM in VirtualBox (assuming you alread have VirtualBox installed)
#
# This script will:
# * Download the latest live ISO image of SmartOS
# * Create a VirtualBox VM, or update an existing VM with the latest ISO
# * Configure the VM with a zones disk, and boot it!
#
#
class Post
include DataMapper::Resource
property :id, Serial
belongs_to :author, :default => lambda { |r, a| Author.first }
end
class Author
include DataMapper::Resource
// this is (of course) a horrible simplification
// but assume that all objects have something like this...
function _get_set(prop, value){
if(typeof(value) !== "undefined"){
this['_' + prop] = value;
}
return this['_' + prop])
}
thing = {
@twobitfool
twobitfool / gist:487862
Created July 23, 2010 18:44
simple dijit example
<html>
<head>
<title>Dojo Test</title>
<style type="text/css">
/* use the tundra theme */
@import "http://ajax.googleapis.com/ajax/libs/dojo/1.5/dijit/themes/claro/claro.css";
/* Note that if you don't specify a minor revision, e.g. 1.5.0 or 1.4.3, the CDN will deliver the latest version */
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js.uncompressed.js" djConfig="parseOnLoad:true"></script>
<script type="text/javascript">