Skip to content

Instantly share code, notes, and snippets.

View Docker Tutorial
# Docker vs VM
- light weight
- access to a bunch of images... docker hub
- fast
# Docker? It's really not that difficult
- Dockerfile
- Image
- Container
- Docker compose
View matrix.java
class matrix {
//////////////////////////////////////////////////////////////////
// Class matrix:
//
// This is a 2 dimensional real matrix class. Objects of this
// type are instantiated as e.g.
//
// matrix A = matrix(3, 2);
//
// in which case, A is a matrix with 3 rows and 2 columns of
View afl.tex
\documentclass[12pt]{article}
\usepackage{amsmath} % flere matematikkommandoer
\usepackage[utf8]{inputenc} % æøå
\usepackage[T1]{fontenc} % mere æøå
\usepackage[danish]{babel} % orddeling
\usepackage{verbatim} % så man kan skrive ren tekst
\usepackage[all]{xy} % den sidste (avancerede) formel i dokumentet
\usepackage{listings}
\lstset{
numbers=left
View TabsFragmentActivity.java
package com.snot.findawatertap;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.ActionBarActivity;
View TabsFragmentActivity.java
package com.snot.findawatertap;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.ActionBarActivity;
View AndroidManifest.xml
<activity android:name=".GroupPickerActivity">
<intent-filter>
<action android:name="android.intent.action.PICK" />
<data android:scheme="content" android:mimeType="com.android.contacts/groups" />
</intent-filter>
</activity>
View mkicons.sh
#! /bin/sh
if [ $# -eq 0 ] ; then
echo "Usage: $0 ICON_FILE PROJECT_DIR"
exit 0
fi
ICON="$1"
PROJECT="$2"
View TabsFragmentActivity.java
package com.snot.bloatware;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.util.Log;
View mycontroller
class DevicesController < ApplicationController
before_filter :authenticate_user!, :only => [:new, :create, :edit, :update, :destroy]
def update_registration_id
@device = Device.find_by_device_id(params[:device_id])
@device.registration_id = params[:registration_id]
@device.save
end
@tonsV2
tonsV2 / gist:819459
Created February 9, 2011 22:29
Nested resources and pagination
View gist:819459
route:
resources :muscle_groups do
resources :muscles
end
controller index method:
def index
if params[:muscle_group_id]
muscle_group_id = params[:muscle_group_id]