Skip to content

Instantly share code, notes, and snippets.

@worldsayshi
worldsayshi / package.json
Last active January 5, 2016 17:08
Browserify es6 and react example build/watch script.
{
"name": "redux-browserify-es6-example",
"main": "js/index.js",
"scripts": {
"test": "mocha --require babel-core/register",
"test:watch": "npm test -- --watch"
},
"dependencies": {
"expect": "^1.13.4",
"express": "^4.13.3",
@worldsayshi
worldsayshi / 50-synaptics.conf
Created March 18, 2016 13:43
Fixing Mac-like touch settings on Ubuntu laptop with somewhat mac-like touchpad
Section "InputClass"
Identifier "touchpad catchall"
Driver "synaptics"
MatchIsTouchpad "on"
# This option is recommend on all Linux systems using evdev, but cannot be
# enabled by default. See the following link for details:
# http://who-t.blogspot.com/2010/11/how-to-ignore-configuration-errors.html
MatchDevicePath "/dev/input/event*"
Option "SoftButtonAreas" "0 0 0 0 0 0 0 0"
Option "VertScrollDelta" "-30

For anyone working iteratively using webpack --watch: First do npm install node-notifier --save-dev and then put this into webpack.config.js:

const notifier = require('node-notifier');
  ...
  plugins: [
    function() {
      this.plugin("done", function(stats) {
          if (stats.hasErrors()) {
            notifier.notify('Error');
 } else {
@worldsayshi
worldsayshi / ReactIFrame.jsx
Last active May 10, 2016 13:35
Reactive iframe with React
import React from 'react';
/*
Reactive iframe - Usage:
<Iframe html={myPlainTextHtml} />
Or if using the safer alternative:
<Iframe>
<div>hello world</div>
</Iframe>
@worldsayshi
worldsayshi / FileWatcher.gd
Created January 7, 2025 20:23
Detect when Godot performs hot reload
class_name FileWatcher extends Node
var last_hash: String = ""
func watch_file(filepath: String, callback: Callable):
var timer = Timer.new()
# Function to get file hash
var get_hash = func():
var file = FileAccess.open(filepath, FileAccess.READ)