Skip to content

Instantly share code, notes, and snippets.

@adriancmiranda
adriancmiranda / usage.js
Last active September 19, 2024 21:49
Hook for canvas rendering in react | useCanvas.js | useWindowSize.js
import React from 'react';
import useCanvas from './useCanvas';
import useWindowSize from './useWindowSize';
const Canvas = (props) => {
const [canvasRef, tracer] = useCanvas('2d');
const [width, height] = useWindowSize();
const draw = tracer((gl) => {
gl.clearRect(0, 0, width, height);
@phaedryx
phaedryx / summary
Last active June 14, 2024 04:58
Loyalty and Layoffs by David Brady
Original text here: https://whydavewhy.com/2013/08/16/loyalty-and-layoffs/
@JosefJezek
JosefJezek / eps-to-svg.md
Last active March 19, 2024 07:48
EPS to SVG Conversion using Inkscape

EPS to SVG using Inkscape Gittip

Author: Josef Jezek

# Install Inkscape on Ubuntu
sudo apt-get install inkscape
@jonjaques
jonjaques / app.html
Created May 13, 2012 03:02
Less version for reusability and (slightly) more semantic HTML. Full-height 2-column fixed-width plus fluid with header.
<!doctype html>
<html lang="en">
<head>
<title>Test</title>
<link rel="stylesheet/less" type="text/css" href="app.less">
<script src="http://cdnjs.cloudflare.com/ajax/libs/less.js/1.3.0/less-1.3.0.min.js" type="text/javascript"></script>
</head>
<body>
<header id="appHeader">Header here</header>
@duanecilliers
duanecilliers / wp-bootstrap-walker-class.php
Created February 13, 2012 14:45
Extended Walker Class for Twitter Bootsrap Navigation Wordpress Integration
<?php
class Bootstrap_Walker_Nav_Menu extends Walker_Nav_Menu {
function start_lvl( &$output, $depth ) {
//In a child UL, add the 'dropdown-menu' class
$indent = str_repeat( "\t", $depth );
$output .= "\n$indent<ul class=\"dropdown-menu\">\n";
@aurelian
aurelian / controller.rb
Created January 20, 2011 16:03
dumps sass variables
# ref: http://bit.ly/fN2ep8
# http://twitpic.com/3rr8dk
def sass_colors
engine= Sass::Engine.new(File.read("app/stylesheets/_colors.scss"), :syntax => :scss, :load_paths => ["app/stylesheets"])
environment= Sass::Environment.new
engine.to_tree.children.each do | node |
next unless node.kind_of? Sass::Tree::VariableNode
node.perform environment
end
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Created: 2010/12/05
// Updated: 2018/09/12
// License: MIT
//
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it)
//