Skip to content

Instantly share code, notes, and snippets.

View deltreey's full-sized avatar

Ted Coderman deltreey

View GitHub Profile
<!DOCTYPE html>
<html>
<head><title>SOUND</title></head>
<body>
<div>Frequence: <span id="frequency"></span></div>
<script type="text/javascript">
var audioCtx = new (window.AudioContext || window.webkitAudioContext)();
var oscillatorNode = audioCtx.createOscillator();
var gainNode = audioCtx.createGain();
@deltreey
deltreey / togglewatch.js
Created January 26, 2016 23:05 — forked from mariussoutier/togglewatch.js
Toggle an AngularJS $watch expression. The default $watch can only be toggled once.
var toggleWatch = function(watchExpr, fn) {
var watchFn;
return function() {
if (watchFn) {
watchFn();
watchFn = undefined;
console.log("Disabled " + watchExpr);
} else {
watchFn = $scope.$watch(watchExpr, fn);
console.log("Enabled " + watchExpr);
21:33:26.936 ConEmu 150705[64] log[1]
21:33:26.937 Startup info
OsVer: 10.0.10240.x64, Product: 1, SP: 0.0, Suite: 0x300, SM_SERVERR2: 0
CSDVersion: , ReactOS: 0 (), Rsrv: 0
DBCS: 0, WINE: 0, PE: 0, Remote: 0, ACP: 1252, OEMCP: 437, Admin: 0
Desktop: Winsta0\Default; BPP: 32
Title: C:\Program Files\ConEmu\ConEmu64.exe
Size: {0,0},{0,0}
Flags: 0x00000401, ShowWindow: 1, ConHWnd: 0x00000000
Handles: 0x00000000, 0x00010001, 0x00000000

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
#!/bin/sh
SHORTCUT="[Desktop Entry]
Name=Sublime Text 3
Comment=Edit text files
Exec=/usr/local/sublime-text-3/sublime_text
Icon=/usr/local/sublime-text-3/Icon/128x128/sublime_text.png
Terminal=false
Type=Application
Encoding=UTF-8
Categories=Utility;TextEditor;"
/**
* An AngularJS directive for Dropzone.js, http://www.dropzonejs.com/
*
* Usage:
*
* <div ng-app="app" ng-controller="SomeCtrl">
* <button dropzone="dropzoneConfig">
* Drag and drop files here or click to upload
* </button>
* </div>

Free disk space when /boot is full (Ubuntu)

TL;DR

dpkg -l linux-image*
uname -r
sudo apt-get remove linux-image-2.6.32-{21,37,38,39,40,41,42,43,44}-server
sudo apt-get autoremove
@deltreey
deltreey / gist:6295977
Last active December 21, 2015 10:59
CleanTables is a Javascript table handler with filtering, sorting, styling, and more.
var cleanTable = function (tableId) {
var tbl = this;
tbl.id = tableId;
tbl.columns = [];
tbl.rows = [];
tbl.visibleRows = [];
tbl.displayedRows = [];
tbl.hiddenColumns = [];
tbl.sortColumn = null;
@deltreey
deltreey / gist:3236391
Created August 2, 2012 11:27 — forked from osahyoun/gist:3236111
JSON#stringify
var javascript_obj = {animal: 'Zebra'};
typeof javascript_obj;
// "object"
var json_obj = JSON.stringify(javascript_obj);
typeof json_obj;
// "string"
​document.write(json_obj);
// {"animal":"Zebra"}