Skip to content

Instantly share code, notes, and snippets.

View andrewsuzuki's full-sized avatar

Andrew Suzuki andrewsuzuki

View GitHub Profile
@andrewsuzuki
andrewsuzuki / open_window_after_idle.au3
Created January 22, 2020 00:54
AutoIt script for activating (focusing) a window automatically after an idle timeout (no mouse/keyboard interaction)
; Activate window after idle timeout
; Script for AutoIt (Windows)
; by Andrew Suzuki
#include <WinAPISys.au3>
$title = "YOUR WINDOW TITLE HERE"
$minutes = 2 ; every two minutes
$sleepTimeMillis = 5*1000 ; check every 5 seconds
@andrewsuzuki
andrewsuzuki / sanitize.js
Created May 10, 2017 02:26
Sanitize.css CSS-in-JS Style Object (sanitize.js)
/*! sanitize.css v5.0.0 | CC0 License | github.com/jonathantneal/sanitize.css */
/* Converted to js style objects for use in css-in-js solutions like glamor, jss, aphrodite, etc */
/* Gotcha: b, strong may not be correct boldness in safari 6? see line 71 */
export default {
'*, ::before, ::after': {
backgroundRepeat: 'no-repeat',
boxSizing: 'inherit',
@andrewsuzuki
andrewsuzuki / analytics.cljs
Last active December 8, 2019 15:31
clojurescript google analytics autotrack
(ns MY_NAMESPACE.analytics
(:require [cljsjs.google-analytics]
[autotrack]))
(def tracking-code "UA-XXXXX-Y")
(defn start []
(js/ga "create" tracking-code "auto")
(js/ga "require" "autotrack")
(js/ga "send" "pageview"))
@andrewsuzuki
andrewsuzuki / convert.sh
Created December 10, 2015 20:09
Pandoc convert tex to pdf shell
#!/bin/bash
pandoc -s ${1}.tex -o ${1}.pdf
@andrewsuzuki
andrewsuzuki / InfiniteScroll.js
Last active September 19, 2017 01:51
Infinite Scroll for React using ES6/7
import React from 'react'
function topPosition(domEl) {
if (!domEl) {
return 0
}
return domEl.offsetTop + topPosition(domEl.offsetParent)
}
public Contact searchContact(String nick)
{
for (Contact contact : _contactList)
{
String testnick = contact.getNickName();
if (testnick != null && testnick.equals(nick))
{
return contact;
}
public Contact searchContact(String nickName)
{
for (int n = 0; n < _contactList.size(); n++)
{
Contact c = _contactList.get(n);
if (c != null && nickName.equals(c.getNickName()))
{
return _contactList.get(n);
}
}
for (Message message : _mailbox)
{
message.save(ab, ps);
}
@andrewsuzuki
andrewsuzuki / Meeeeeep.terminal
Created January 27, 2015 19:27
Meeeeeep Purple OSX Terminal
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BackgroundAlphaInactive</key>
<real>0.89893424855491333</real>
<key>BackgroundBlurInactive</key>
<real>0.20000000000000001</real>
<key>BackgroundColor</key>
<data>
@andrewsuzuki
andrewsuzuki / countfile.py
Created May 6, 2014 18:49
Counts lines, words, and characters of a file
#!/usr/bin/env python3.1
import os
def docount(string):
lines = string.split("\n")
line_count = len(lines)
word_count = 0
char_count = 0