Skip to content

Instantly share code, notes, and snippets.

@awsp
awsp / CalendarView.java
Created June 22, 2018 18:15 — forked from james-d/CalendarView.java
Simple demo of creating a appointment-calendar like view (similar to the default calendar view in Google Calendar), in JavaFX 8. Just manages selection of time slots in the grid.
package calendarview;
import java.time.DayOfWeek;
import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
@awsp
awsp / mp3.js
Created May 12, 2017 10:27 — forked from dtrce/mp3.js
streaming mp3 using nodejs
var http = require('http'),
fileSystem = require('fs'),
path = require('path')
util = require('util');
http.createServer(function(request, response) {
var filePath = 'path_to_file.mp3';
var stat = fileSystem.statSync(filePath);
response.writeHead(200, {
@awsp
awsp / responsive.css
Created January 3, 2017 10:15 — forked from helielson/responsive.css
Boilerplate CSS Media Queries
* Smartphones (portrait and landscape) ----------- */
@media only screen and (min-device-width : 320px) and (max-device-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) ----------- */
@media only screen and (min-width : 321px) {
/* Styles */
}
@awsp
awsp / tmux.md
Created July 22, 2016 18:46 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@awsp
awsp / delete-targz.php
Last active July 6, 2016 19:10 — forked from Xeroday/delete-targz.php
Deletes .tar.gz files older than 7 days.
<?php
$files = glob("*.tar.gz");
$days = 7;
foreach($files as $file) {
if(is_file($file)
&& time() - filemtime($file) >= $days*24*60*60) {
unlink($file);
}
}
@awsp
awsp / EasyJumpPreciseMotionAce.vim
Created June 29, 2016 19:14 — forked from gfixler/EasyJumpPreciseMotionAce.vim
A Vim take on Emacs' AceJump mode, itself based on Vim's PreciseJump and EasyMotion plugins
" ACEJUMP
" Based on emacs' AceJump feature (http://www.emacswiki.org/emacs/AceJump).
" AceJump based on these Vim plugins:
" EasyMotion (http://www.vim.org/scripts/script.php?script_id=3526)
" PreciseJump (http://www.vim.org/scripts/script.php?script_id=3437)
" Type AJ mapping, followed by a lower or uppercase letter.
" All words on the screen starting with that letter will have
" their first letters replaced with a sequential character.
" Type this character to jump to that word.
@awsp
awsp / setup-dev.sh
Last active August 29, 2015 14:27
Install homebrew, nginx, mysql, php55, and composer on Mac OS X
#!/bin/bash
# install homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# install homebrew's official php tap
brew tap josegonzalez/homebrew-php
@awsp
awsp / common.js
Last active August 29, 2015 14:20 — forked from markdaws/common.js
// common.js ======================================
(function(exports) {
// Define all your functions on the exports object
exports.foo = function() {
return 'bar';
};
})((typeof process === 'undefined' || !process.versions)
@awsp
awsp / tinytest.api
Last active August 29, 2015 14:18 — forked from stbaer/tinytest.api
test.isFalse(v, msg)
test.isTrue(v, msg)
test.equal(actual, expected, message, not)
test.length(obj, len)
test.include(s, v)
test.isNaN(v, msg)
test.isUndefined(v, msg)
test.isNotNull
test.isNull
test.throws(func)
tell application "iTunes"
activate
set newPreset to make new EQ preset
set name of newPreset to "Eargasm Explosion"
set band 1 of newPreset to 3
set band 2 of newPreset to 6
set band 3 of newPreset to 9
set band 4 of newPreset to 7
set band 5 of newPreset to 6
set band 6 of newPreset to 5