Skip to content

Instantly share code, notes, and snippets.

View andorfermichael's full-sized avatar

Michael Andorfer andorfermichael

  • Salzburg, Austria, Europe
  • 02:46 (UTC +02:00)
View GitHub Profile
import {Injectable, provide} from 'angular2/core';
import {Observable} from 'rxjs';
const GEOLOCATION_ERRORS = {
'errors.location.unsupportedBrowser': 'Browser does not support location services',
'errors.location.permissionDenied': 'You have rejected access to your location',
'errors.location.positionUnavailable': 'Unable to determine your location',
'errors.location.timeout': 'Service timeout has been reached'
};
@code0100fun
code0100fun / app_controllers_sign-in.js
Created June 8, 2015 20:02
Ember Simple AUth + Ember CLI Mirage
// app/controllers/sign-in.js
import Ember from 'ember';
export default Ember.Controller.extend({
actions: {
signIn(){
this.set('errors', null);
var params = { identification: this.get('email'), password: this.get('password') };
// Redirects to index route on success (configurable in config/environment.js)
this.get('session').authenticate('simple-auth-authenticator:oauth2-password-grant', params);
@protrolium
protrolium / ffmpeg.md
Last active May 25, 2026 14:10
ffmpeg guide

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

You can get the list of installed codecs with:

@NicholasMurray
NicholasMurray / AngularJS Geolocation Directive Jasmine Geolocation Not Available Test
Created February 18, 2015 23:27
AngularJS Geolocation Directive Jasmine Geolocation Not Available Test
describe('Directive tests: geolocation ', function() {
var $window, navigator;
describe('when called on a browser that does not have geolocation available ', function() {
beforeEach(module('geolocationApp'));
beforeEach(inject(function($rootScope, $compile, _$window_) {
element = angular.element('<geolocation class="geolocation"><p>This is a geolocation app</p></geolocation>');
@mikelehen
mikelehen / generate-pushid.js
Created February 11, 2015 17:34
JavaScript code for generating Firebase Push IDs
/**
* Fancy ID generator that creates 20-character string identifiers with the following properties:
*
* 1. They're based on timestamp so that they sort *after* any existing ids.
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs.
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly).
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the
* latter ones will sort after the former ones. We do this by using the previous random bits
* but "incrementing" them by 1 (only in the case of a timestamp collision).
*/
@StefanWallin
StefanWallin / README.md
Last active January 15, 2022 06:22 — forked from konklone/ssl.rules
nginx ssl config with multiple SNI vhosts and A+ SSL Labs score as of 2014-11-05

Configuring nginx for SSL SNI vhosts

Gotchas

Remarks

  • My version of konklones SSL config does not have SPDY support(my nginx+openssl does not support it)
  • You need a default ssl server (example.org-default.conf).
  • Some SSL-options have to be unique across your instance, so it's easier to have them in a common file(ssl.conf).
@marchawkins
marchawkins / voice-command-time-test.html
Created March 3, 2014 18:58
Using annyang javascript library (https://www.talater.com/annyang/) to capture a command, process it and speak the result with the html 5 speech synthesis api. This demo works on the desktop and Android versions of Chrome. The 'time' is based on the user's system clock For this test, click **Listen** and ask "What time is it?" (after clicking "a…
<div class="row">
<div class="col-md-2 col-sm-2 col-xs-2">
<p><button class="btn btn-primary btn-sm" id="speak-btn"><span>Listen</span></button></p>
</div><!-- .col -->
<div class="col-md-10 col-sm-10 col-xs-10">
<div class="panel panel-default">
<div class="panel-heading">Response Status</div>
<div class="panel-body">
<textarea id="status" class="form-control" placeholder="Spoken text will appear here"></textarea>
</div>
@wsargent
wsargent / docker_cheat.md
Last active May 27, 2026 15:46
Docker cheat sheet
@hofmannsven
hofmannsven / README.md
Last active June 11, 2026 03:37
Git CLI Cheatsheet
@plentz
plentz / nginx.conf
Last active July 23, 2026 11:59
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048