Skip to content

Instantly share code, notes, and snippets.

@naddeoa
naddeoa / main.ts
Created February 26, 2018 07:05
Hello world for cycle JS. I might be doing something wrong. At this rate, it will end up looking a lot like Elm, but with the complication of streams.
import { div, DOMSource, h1, makeDOMDriver, VNode, input } from '@cycle/dom';
import { run } from '@cycle/xstream-run';
import xs, { Stream } from 'xstream';
import SearchBox, { SearchBoxProps } from './SearchBox';
export interface Sources {
DOM: DOMSource;
}
@naddeoa
naddeoa / hello-world-lumo.cljs
Last active October 9, 2017 18:20
Simple hello world for using Lumo to run Clojurescript scripts
#!/usr/bin/env lumo
(ns hello.core
(:require [cljs.nodejs :as node]
[clojure.pprint :refer [pprint]]
[cljs.core :refer [*command-line-args*]]))
(pprint (str "Command line args: " *command-line-args*))
@naddeoa
naddeoa / Plugin.ts
Created May 29, 2017 18:59
Using workspace configurations when writing visual studio code plugins
import { Uri, languages, Disposable, WorkspaceConfiguration, workspace } from 'vscode';
const config = workspace.getConfiguration(); // empty to get your own plugin's configuration
const options = config.get("options");
console.log(options); // ["option1", "option2"]
@naddeoa
naddeoa / gnome-shell-menu-items-example.js
Created May 15, 2017 02:45
Minimal example of how to create a gnome shell extension that has a menu, menu items, and a label that updates on a timer
// Basic stuff
const St = imports.gi.St;
const Lang = imports.lang;
// UI specific components
const Main = imports.ui.main;
const PopupMenu = imports.ui.popupMenu;
const PanelMenu = imports.ui.panelMenu;
const Mainloop = imports.mainloop;
@naddeoa
naddeoa / simple_gnome_extension_icon.js
Created May 15, 2017 01:04
Minimal example of a gnome extension that just shows some text in the menu bar
const St = imports.gi.St;
const Lang = imports.lang;
// UI specific components
const Main = imports.ui.main;
const PanelMenu = imports.ui.panelMenu;
const Indicator = new Lang.Class({
Name: 'GnomeBitBarIndicator', // does this even matter?
Extends: PanelMenu.Button,
@naddeoa
naddeoa / git-browser-diff
Created December 5, 2016 03:08
Quick, pretty git diff in the browser from the command line
#!/bin/bash
# Make the column size whatever you want. 230 seemed reasonable in my testing.
# On Ubuntu, you can get these dependnecies with `sudo apt-get install ruby-bcat colordiff`
git difftool -y -x "colordiff -y -W 230" $1 | bcat
@naddeoa
naddeoa / xps-touchscreen-workaround.service
Last active February 14, 2024 22:03
I just got an XPS and I ran into the issue where the touch screen stops working after resume. After doing a little digging, I was able to find out that this is fixed in the Linux kernel by a developer named Mika Westerberg. I got in touch with him and he was able to set me off on the right track for developing a proper work around that I could u…
[Unit]
Description=Potentially dangerous fix touchscreen after resume on the XPS 13 9350
After=suspend.target
[Service]
Type=simple
ExecStart=/home/anthony/path/to/xps-touchscreen-workaround.sh
[Install]
WantedBy=suspend.target
@naddeoa
naddeoa / git-line-diff
Created February 14, 2015 16:33
Get the difference in line numbers between two get commits
#!/bin/sh
# Get the difference between to git commit's total lines of code
# $1 a git commit
# $2 another git commit, after $1 chronologically
# Example:
# git line-diff HEAD HEAD~
# git line-diff 1aab45 453b7a
#
# If you put this script on your path somewhere and name it git-line-diff, then
# git will run it when you type `git line-diff`
@naddeoa
naddeoa / gnome-terminal-utf8.sh
Created February 14, 2015 15:49
Enable UTF-8 encoding in gnome-terminal on Ubuntu. Without this, you may have to enable it in the menu bar per session
#!/bin/sh
# Enable UTF-8 encoding in gnome-terminal on Ubuntu. Without this, you may have
# to enable it in the menu bar per session.
gconftool --set --type=string /apps/gnome-terminal/profiles/Default/encoding en_UTF.8