Skip to content

Instantly share code, notes, and snippets.

@yang
yang / gist:c9c3576d86a0c157a715e97ebb848373
Created January 29, 2022 07:43
Import Tailwind tokens
// Run this script in your directory containing tailwind.config.js, and follow the printed instructions to import them into your project.
const defaultTheme = require('tailwindcss/defaultTheme')
const colors = require('tailwindcss/colors')
const config = require('./tailwind.config')
const extended = {
spacing: Object.assign({}, defaultTheme.spacing, config.theme.extend.spacing),
fontFamily: Object.assign({}, defaultTheme.fontFamily, config.theme.extend.fontFamily),
colors: Object.assign({}, defaultTheme.colors, config.theme.extend.colors),
@yang
yang / aoeu
Created November 22, 2021 20:15
Created from Remix Form!
aoeu
@yang
yang / index.html
Created July 15, 2018 06:58 — forked from lyudmil-mitev/index.html
CSS Transform Scale element to fit its parent
<html>
<head>
<title>CSS Transform Scale element to fit its parent</title>
<script src="scale2fit.js"></script>
<link rel="stylesheet" href="style.css"/>
<script>
(function(window) {
function main() {
const margin = 10;
requestAnimationFrame(function fitToParentOnResize() {
@yang
yang / code and results.txt
Last active June 12, 2018 00:25
Silly array benchmarks in diff languages
Ran on a 2015 MBP
HOTSPOT
public class Main {
public static void main(String[] args) {
int[] a = new int[500000000];
int[] b = new int[60000000];
@yang
yang / main.jsx
Last active August 29, 2015 14:27
Testing out React diff algo
var TimerA = React.createClass({
getInitialState: function() {
return {start: this.props.start};
},
render: function() {
return (
<div>Seconds Elapsed: {this.state.start}</div>
);
}
@yang
yang / gist:3365293
Created August 16, 2012 01:16
Debugging Ubuntu 12.04 Desktop freeze
$ sudo lshw
zs
description: Tower Computer
product: Dell DXP061 ()
vendor: Winbond Electronics
serial: G5LYWD1
width: 64 bits
capabilities: smbios-2.3 dmi-2.3 vsyscall32
configuration: administrator_password=enabled boot=normal chassis=tower power-on_password=enabled uuid=44454C4C-3500-104C-8059-C7C04F574431
*-core
@yang
yang / gist:2419515
Created April 19, 2012 08:01
Bookmarklet to download Chrome extension files (CRX files) from Chrome webstore
If you want to access the source code of a Chrome extension, you need to get the .crx file. This bookmarklet downloads the .crx file for the Chrome extension you're viewing. You'll be prompted to install it; before dismissing the dialog, check in your Downloads directory. Then just unzip the .crx (it's a zip file).
javascript:window.open('https://clients2.google.com/service/update2/crx?response=redirect&x=id%3D' + /webstore\/detail\/([^\/]+)/.exec(window.location.href)[1] + '%26uc')
javascript:window.open%28%27https%3A//clients2.google.com/service/update2/crx%3Fresponse%3Dredirect%26x%3Did%253D%27%20%2B%20/webstore%5C/detail%5C/%28%5B%5E%5C/%5D%2B%29/.exec%28window.location.href%29%5B1%5D%20%2B%20%27%2526uc%27%29
import org.scalatra._
import scalate.ScalateSupport
object Web extends App {
import org.mortbay.jetty.Server
import org.mortbay.jetty.webapp.WebAppContext
val webapp = new WebAppContext
webapp.setDescriptor("src/main/webapp/WEB-INF/web.xml")
webapp.setResourceBase("src/main/webapp/")
val server = new Server(8080)
mysql> show full processlist;
+-----+------+-----------------+-------+------------+------+----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Id | User | Host | db | Command | Time | State | Info |
+-----+------+-----------------+-------+------------+------+----------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------