Skip to content

Instantly share code, notes, and snippets.

View Tam's full-sized avatar
🐢
I may be slow to respond.

Tam Tam

🐢
I may be slow to respond.
View GitHub Profile
<img src="/assets/img/logo.svg" onerror="this.onerror=null; this.src='/assets/img/logo.jpg'" alt="My Logo">
// On windows, /speaker/deps/mpg123/src/output/win32.c must be replaced with a newer version
console.log('start');
var request = require('request');
console.log('request');
var lame = require('lame');
console.log('lame');
var Speaker = require('speaker');
console.log('Speaker');
var streamUrl = "https://api.soundcloud.com/tracks/91077814/stream?client_id=7868b491b9102e023ee4f3a8d3e6795c";
@Tam
Tam / gulpfile.js
Last active March 19, 2018 08:50
Minimal Gulp setup w/ LESS +autoprefix/compress, JS +jshint/minify
var gulp = require('gulp'),
sourcemaps = require('gulp-sourcemaps'),
uglify = require("gulp-uglify"),
jshint = require("gulp-jshint"),
rename = require("gulp-rename"),
less = require("gulp-less"),
LessPluginCleanCSS = require('less-plugin-clean-css'),
cleancss = new LessPluginCleanCSS({ advanced: true }),
LessPluginAutoPrefix = require('less-plugin-autoprefix'),
autoprefixer = new LessPluginAutoPrefix({ browsers: ["last 2 versions"] });
@Tam
Tam / node_nginx.md
Last active October 19, 2015 12:40
nginx on DigitalOceans NodeJS image

Node / NPM

Use DigitalOceans Ubuntu Node image.

nginx

Install

sudo apt-get update
sudo apt-get install nginx
@Tam
Tam / TextAdventureControls
Last active January 16, 2016 16:22
How to play classic text adventures!
From the first few pages of the manual to
Lost Treasures of Infocom I (also Frotz):
============================================
|| Communicating with Interactive Fiction ||
============================================
With Interactive Fiction, you type your commands in plain English each
time you see the prompt which looks like this:
@Tam
Tam / jetbrains-atom-keymap.cson
Last active February 25, 2016 07:56
A basic JetBrains IDE (IntelliJ,WebStorm,PHPStorm) to Atom Keymap
'atom-text-editor':
'ctrl-g': 'find-and-replace:select-next'
'atom-workspace atom-text-editor:not([mini])':
'cmd-d': 'editor:duplicate-lines'
'alt-shift-up': 'editor:move-line-up'
'alt-shift-down': 'editor:move-line-down'
@Tam
Tam / Swipe-Example.js
Created June 2, 2016 09:38
Vanilla JavaScript Swipe Detection
new Swipe(document.getElementById("gallery"), function(event, direction) {
event.preventDefault();
switch (direction) {
case "up":
// Handle Swipe Up
break;
case "down":
// Handle Swipe Down
break;
function get(url, success, error) {
var request = new XMLHttpRequest();
request.open('GET', window.baseUrl + url, true);
request.setRequestHeader("X-Requested-With", "XMLHttpRequest");
request.onload = function() {
var data = request.responseText;
if (request.status >= 200 && request.status < 400) {
success(data);
} else {
@Tam
Tam / craft-ngrok.php
Created June 27, 2017 12:34
How to get ngrok working with Craft CMS during development
<?php
// When using:
// `ngrok http -host-header=example.dev 80`
$isNgrok = array_key_exists("HTTP_X_ORIGINAL_HOST", $_SERVER) && strpos($_SERVER["HTTP_X_ORIGINAL_HOST"], "ngrok");
$host = 'http://' . $_SERVER[$isNgrok ? 'HTTP_X_ORIGINAL_HOST' : 'SERVER_NAME'] . '/';
return array(