Skip to content

Instantly share code, notes, and snippets.

View kristjanmik's full-sized avatar

Kristján Ingi Mikaelsson kristjanmik

View GitHub Profile

Keybase proof

I hereby claim:

  • I am kristjanmik on github.
  • I am kristjanmik (https://keybase.io/kristjanmik) on keybase.
  • I have a public key ASACX8ujBEmrUL_3p6rHzADDpQqKnpUjaLVMNO6ZP1JdFQo

To claim this, I am signing this object:

function WGS84_To_ISN93(l,m){
l = parseFloat(l);
m = parseFloat(m);
var k=l*0.0174532925199433;
var p=0.0818191913305*Math.sin(k);
var o=11616778.382033*Math.pow(Math.tan(0.785398163397448-(k/2))/Math.pow((1-p)/(1+p),0.04090959566525),0.90633380084752);
var q=(m+19)*0.0158185089469038;
return {
x:Math.round((500000+o*Math.sin(q))*1000)/1000,
y:Math.round((3482044.27322585-o*Math.cos(q))*1000)/1000
highlight -O rtf index.js --line-numbers --font-size 26 --font Inconsolata --style solarized-dark -W -J 70 -j 3 --src-lang js | pbcopy
var filePath = NSBundle.mainBundle().pathForResource("railway", ofType: "gif")
var gif = NSData(contentsOfFile: filePath)
var webViewBG = UIWebView(frame: self.view.frame)
webViewBG.loadData(gif, MIMEType: "image/gif", textEncodingName: nil, baseURL: nil)
webViewBG.userInteractionEnabled = false;
self.view.addSubview(webViewBG)
var filter = UIView()
filter.frame = self.view.frame
var parser = require('apis-parser');
module.exports = function(app,prefix){
console.log('Within function',prefix)
var flights = require('flights');
app.get(prefix + '/:type/kef',function(req,res){
parser(res)(function(cb){
flights.kef({
@kristjanmik
kristjanmik / ti.android.events.js
Last active July 25, 2016 14:58
A proper way to handle pause and resume event in titanium for android
var win = Ti.UI.createWindow({});
win.addEventListener("open", function(e) {
win.activity.addEventListener("resume", function() {
Ti.App.fireEvent('resume')
});
//Notice the pause event
win.activity.addEventListener("pause", function() {
Ti.App.fireEvent('paused')
});
#!/bin/bash
echo "Starting the install process"
sleep 2
sudo apt-get update
echo "Installing Apache2"
sleep 2
sudo apt-get install -y apache2
@kristjanmik
kristjanmik / gist:6563816
Created September 14, 2013 17:20
Restart titanium build on file change
var chokidar = require('chokidar'),
spawn = require('child_process').spawn,
utils = require('util');
var watcher = chokidar.watch('./', {ignored: /^build/, persistent: true});
var lastUpdate = new Date().getTime();
function update(path){
if(typeof path === 'object' || path.indexOf('Resources') !== -1 || path.indexOf('build') !== -1 || path.indexOf('monitor.js') !== -1){
return;
@kristjanmik
kristjanmik / nodeserver
Last active December 22, 2015 21:49
On demand node.js server install script
#!/bin/bash
###Node.js ###
sudo apt-get update
sudo apt-get install -y python-software-properties
sudo apt-get install -y python
sudo apt-get install -y g++
sudo apt-get install -y make
sudo apt-get install -y software-properties-common
sudo add-apt-repository --yes ppa:chris-lea/node.js
var cluster = require('cluster');
if (cluster.isWorker) {
console.log('Worker ' + process.pid + ' has started.');
// Send message to master process.
process.send({msgFromWorker: 'This is from worker ' + process.pid + '.'})
// Receive messages from the master process.