Skip to content

Instantly share code, notes, and snippets.

View martinmidtsund's full-sized avatar

Martin Akre Midtsund martinmidtsund

View GitHub Profile
private void updateCheckedTasks() {
ListView listView = getListView();
int nrOfTasks = listView.getCount();
Log.i("TODO", "This is the number of tasks = "+nrOfTasks); // This prints the 5 items in the list
Task task = null;
for(int i = 0; i < nrOfTasks;i++) {
task = (Task) listView.getItemAtPosition(i); // This doesn't seem to work
Log.i("TODO", "Task = "+task); // This prints that the task is null
if(task.isDone()) listView.setItemChecked(i, true);
}
// Uses line-checking to find all the conflicts(violations) for the given position
private static int conflicts(Point position, int[][] board) {
int nrOfConflicts = 0;
int row = position.x;
int col = position.y;
// Conflicts below position
int runs = 1;
for(int i=(row+1); i<board.length; i++) {
// Vertical down
@martinmidtsund
martinmidtsund / heroku-deploy
Last active April 3, 2017 09:52
Script for deploying a Meteor.js application to Heroku. The script will create a new application on Heroku with the given APPNAME, and add a MongoHQ addon, with the Sandbox plan(free plan with 512 MB MongoDB). It will then deploy your Meteor.js app to heroku.
#!/bin/bash
# Deploy script for Meteor.js to Heroku
#
# Author: Martin A. Midtsund / martin@iterate.no
#
# Before running this script, you need to have these tools in your path:
# meteor - To install: $ curl https://install.meteor.com | sh
# heroku - Install Heroku toolbelt and log in to your user: https://toolbelt.heroku.com/
# git - You'll get this in the Heroku toolbelt, if you don't already have it.
#
# Throw Bindings
#bind 1:ctrl;alt throw 0 resize
#bind 2:ctrl;alt throw 1 resize
#bind 3:ctrl;alt throw 2 resize
bind 2:ctrl;cmd throw right resize
bind 1:ctrl;cmd throw left resize
bind 3:ctrl;cmd throw up resize
bind 4:ctrl;cmd throw down resize
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:maven="http://maven.apache.org/POM/4.0.0">
<xsl:output omit-xml-declaration="no" indent="yes"/>
<xsl:strip-space elements="*" />
<!-- Identity template, copies every element in source file -->
<xsl:template match="node() | @*">
<xsl:copy>
@martinmidtsund
martinmidtsund / example-chat.html
Created December 7, 2015 21:15
Meteor in-memory-collection example chat
<head>
<title>example-chat</title>
</head>
<body>
<h1>Welcome to Meteor!</h1>
{{> hello}}
</body>