Skip to content

Instantly share code, notes, and snippets.

package co.developertime.android.recon;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationManager;
import android.os.Bundle;
import android.util.Log;
let components = UnsafeMutablePointer<CGFloat>.alloc(4)
UIColor.redColor().getRed(&components[0], green: &components[1], blue: &components[2], alpha: &components[3])
CGContextSetFillColor(ctx, components)
#include <stdio.h>
#include <stdlib.h>
typedef struct Grid {
char *grid;
int width;
int height;
} Grid;
Grid *createGrid(int length)
// Scene view setup
sceneView.autoenablesDefaultLighting = true
sceneView.allowsCameraControl = true
let scene = SCNScene()
let rootNode = scene.rootNode
// Box
let boxGeometry = SCNBox(width: 1, height: 1, length: 1, chamferRadius: 0)
let boxMaterial1 = SCNMaterial()

I have a console based Java application. In it, I print a rectangular array of characters. Something like the following.

.....
.....
.....
.....
.....

Essentially, a 5x5 grid.

class Matrix():
def __init__(self, width, height):
self.width = width
self.height = height
# Initialise the matrix grid
self.matrix = []
for row in range(height):
self.matrix.append([])
for column in range(width):
func getMinDistanceBetweenRectangles(a: CGRect, b: CGRect) -> CGFloat {
let deltaX = b.origin.x - a.origin.x
let deltaY = b.origin.y - a.origin.y
let delta = abs(deltaX) > abs(deltaY) ? deltaX : deltaY
var distance: CGFloat = 0
switch (delta >= 0, delta == deltaX) {
case (true, true) : distance = b.origin.x - (a.origin.x + a.width)
case (true, false) : distance = b.origin.y - (a.origin.y + a.height)
#include <stdlib.h>
#include "SocketAddress.h"
#include "Socket.h"
#include "Request.h"
#include "Response.h"
#include "Helpers.h"
int main(int argc, char **argv)
{
public class GintvileFile {
private String name;
private String contents;
public GintvileFile() {
this.contents = "";
}
public String getContents() {
return contents;
}
}
CREATE TEMP TABLE EgzemplioriuSkaiciai(metai, isbn, paimta, pavadinimas)
AS (
SELECT
knyga.metai AS metai,
knyga.isbn AS isbn,
COUNT(egzempliorius.paimta) AS paimta,
knyga.pavadinimas AS pavadinimas
FROM stud.knyga JOIN stud.egzempliorius ON knyga.isbn = egzempliorius.isbn
GROUP BY knyga.isbn);