Skip to content

Instantly share code, notes, and snippets.

View timpulver's full-sized avatar

Tim Pulver timpulver

View GitHub Profile

Tailwind.css + Vue.js

Shows how to create a new Vue.js project with vue-cli 3 which uses Tailwind.css.

Tailwind is a utility-first CSS framework for rapidly building custom user interfaces. Tailwind is written in PostCSS and configured in JavaScript, which means you have the full power of a real programming language at your fingertips.

Tested with Vue.js 3.2.1 and Tailwind.css 0.7.3 (Januar 2019)

  • vue create my-project (I used airbnb-eslint, scss and unit-testing )

Electron Drag’n’Drop

Allows files(s) to be dragged inside the electron app as well as files to be dropped out (when dropped on the desktop e.g. the file will be copied to the destination.

Installation

Clone the Quick Start repository:
git clone https://github.com/electron/electron-quick-start

Go into the repository:

@timpulver
timpulver / pandoc_watch.js
Created May 28, 2016 18:15
Watches a markdown-folder for changes and re-generates .icml (InCopy / Adobe InDesign CC) files on every change
var exec = require('child_process').exec;
var chokidar = require('chokidar');
/*
* Watches a folder for changes in markdown (*.md) files and compiles them to ICML (Adobe InDesign CC / InCopy format)
*
* Dependencies:
* - Install Pandoc: pandoc.org
* - Run "npm install chokidar"
*
@timpulver
timpulver / Android_Play_Audio_File_Processing.pde
Created December 21, 2015 00:12
Plays an audio / sound file (Mp3) on Android using Processing and the MediaPlayer class.
/**
* Android Audio Player example, copied from https://forum.processing.org/two/discussion/12819/how-do-i-get-sound-to-play-on-the-phone
*
* Some audio formats seem not to be recognized (maybe some MP3-codecs as well), put the audio file into the data-directory.
*/
import android.media.MediaPlayer;
import android.content.res.AssetFileDescriptor;
import android.content.Context;
import android.app.Activity;
@timpulver
timpulver / arduino_processing_analog_audio_file.md
Last active November 28, 2017 19:24
How to trigger an audio file with an analog sensor using Processing and Arduino

Keywords: Arduino, Processing, Serial, Communication, Analog, Sensor, Distance, Pressure, Prototyping, Minim, Audio, MP3, Play, Audio File
Author: Tim Pulver
Last update: 2015-12-07

Wiring

In this example we are using an analog distance sensor (Sharp 2Y0A02). The setup will be very similar when you are using another sort of analog sensor (e.g. an analog pressure sensor). Make sure to know the right pin order. What mostly works here is to google for the part you want to use (e.g. pressure sensor) together with the keyword arduino, so e.g. arduino pressure sensor. You will then find some images showing how to wire the sensor up. In all cases you need to connect one wire to 5V on the Arduino (red here), one to GND / Ground (black here) and one to an analog pin – in this case A0 (yellow / white / green wire).

Distance Sensor Hookup Image

bash_autocomplete for projects in todo.txt

open ~/.bash_profile and add:

alias t='/usr/local/bin/todo.sh'
TODO_TXT_FILE="/path/to/todo-txt/todo.txt"
complete -W  "$(cat $TODO_TXT_FILE | grep -ow '\+\w*' | uniq | xargs)" t
```
#Add to ~/.bash_profile
# Create an alias for the program
alias t='/usr/local/bin/todo.sh'
# Add auto-completion with custom word list to command "t"
complete -W "subcommand1 anothersubcommand" t
@timpulver
timpulver / read_mac_file_tags.js
Created September 17, 2015 12:49
Read Mac OS X Finder file tags in Node.js
var exec = require('child_process').exec;
// Outputs the Mac OS X Finder tags of a file
// in the same directory as the script.
// Depends on tag (https://github.com/jdberry/tag)
var filename = "some_file_with_tags.md";
readTags(filename);
@timpulver
timpulver / index.html
Created January 28, 2015 13:02 — forked from couchand/index.html
[D3.js, Click, Double-Click] Distinguish between click and double-click and use data
<!DOCTYPE html>
<html>
<head>
<script src="http://d3js.org/d3.v3.min.js"></script>
<style>
body { margin:0; padding:0; }
#map { width:960px; height:500px; background:#000; }
</style>
</head>
<body>
@timpulver
timpulver / load_public_dropbox_file_and_use_it_in_d3.js.md
Created January 27, 2015 21:18
[Javascript, D3.js, Dropbox] Visualize public JSON file from Dropbox in D3.js

Dropbox, D3.js, File, Folder, Public, Load, JSON, JSONP, CORS, Access-Control-Allow-Origin, Error

If you try to load a public JSON-file from Dropbox, you will probably get this error message:

XMLHttpRequest cannot load https://www.dropbox.com/s/123456789/data.json?dl=0. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8000' is therefore not allowed access.

To load the file successfully, you have to change the end dl=0 to dl=1 and replace www.dropbox.com with dl.dropboxusercontent.com, so the URL should look like this: https://dl.dropboxusercontent.com/s/123456789/data.json?dl=1.

Now you can call: