Skip to content

Instantly share code, notes, and snippets.

View ahnerd's full-sized avatar

Ahnerd ahnerd

View GitHub Profile
@ahnerd
ahnerd / using-SpeechSynthesisUtterance.md
Created October 14, 2016 19:32
how to SpeechSynthesisUtterance for speech synthesis in the browser(Chrome,Firefox,Opera)
speechSynthesis.onvoiceschanged = function() {
  var msg = new SpeechSynthesisUtterance();
  msg.voice = this.getVoices().filter(v => v.name == 'Cellos')[0];
  msg.text = Object.keys(window).join(' ');
  this.speak(msg);

};

@ahnerd
ahnerd / install-opera40-on-ubuntu.md
Created October 11, 2016 23:52
This gist shows you how to install Opera 40 on Ubuntu 32 bit
@ahnerd
ahnerd / how-to-install-opera-browser-from-ppa-on-ubuntu.md
Created October 11, 2016 20:12
How to install Opera browser in Ubuntu from PPA

How to install Opera browser in Ubuntu from PPA

To install the Opera browser from PP under Ubuntu you need to follow these steps :

Before starting open up your terminal.

First you need to setup the key with

wget -O - http://deb.opera.com/archive.key | sudo apt-key add -
@ahnerd
ahnerd / build_sqlite3.bat
Last active August 4, 2016 01:40
Use sqlite3 with Electron in Windows(http://www.techiediaries.com)
@echo off
cd /d %~dp0
cd /d node_modules\sqlite3
call npm install
call npm run prepublish
call node-gyp configure --module_name=node_sqlite3 --module_path=../lib/binding/node-v47-win32-ia32
call node-gyp rebuild --target=0.36.4 --arch=ia32 --target_platform=win32 --dist-url=https://atom.io/download/atom-shell --module_name=node_sqlite3 --module_path=../lib/binding/node-v47-win32-ia32
cd /d %~dp0
exit /B 0
@ahnerd
ahnerd / splash.html
Created August 3, 2016 21:54
A loading animation to use as a splash screen in an Electron project (http://www.techiediaries.com)
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
html {
background: #333333;
}
body {
@ahnerd
ahnerd / open-url.js
Created August 3, 2016 21:47
How to open a link in default browser with electron shell (http://www.techiediaries.com)
var shell = require('electron').shell;
document.addEventListener('DOMContentLoaded',function(){
var el = document.querySelector('#mylink');
el.addEventListener('click',function(event){
event.preventDefault();
shell.openExternal(this.href);
});
})
/**
* Be sure to include library scripts in this order. Can be placed either
* in the header or footer.
*/
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-infinitescroll/2.0b2.120519/jquery.infinitescroll.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/masonry/3.1.2/masonry.pkgd.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery.imagesloaded/3.0.4/jquery.imagesloaded.min.js"></script>
@ahnerd
ahnerd / ubuntu-compass-ruby
Created February 13, 2016 16:18 — forked from stephanetimmermans/ubuntu-compass-ruby
Install Compass+Ruby on Ubuntu 14.04
#https://gorails.com/setup/ubuntu/14.04
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties
sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc
rvm install 2.1.2
rvm use 2.1.2 --default
@ahnerd
ahnerd / Encbox.md
Created November 21, 2015 11:32 — forked from Tho85/Encbox.md

Build your own private, encrypted, open-source Dropbox-esque sync folder

Prerequisites:

  • One or more clients running a UNIX-like OS. Examples are given for Ubuntu 12.04 LTS, although all software components are available for other platforms as well (e.g. OS X). YMMV
  • A cheap Ubuntu 12.04 VPS with storage. I recommend Backupsy, they offer 250GB storage for $5/month. Ask Google for coupon codes.

Software components used:

  • Unison for file synchronization
  • EncFS for folder encryption
@ahnerd
ahnerd / backuprestorejson.js
Created September 23, 2015 14:39
JavaScript and jQuery based backup and restore mechanism in JSON format.
// change to your database
var db = window.openDatabase("YourApp", "1.0.0", "DatabaseName", 5*1024); // 5*1024 is size in bytes
// file fail function
function failFile(error) {
console.log("PhoneGap Plugin: FileSystem: Message: file does not exists, isn't writeable or isn't readable. Error code: " + error.code);
alert('No backup is found, or backup is corrupt.');
}
// start backup (trigger this function with a button or a page load or something)