Skip to content

Instantly share code, notes, and snippets.

View raniejade's full-sized avatar

Ranie Jade Ramiso raniejade

View GitHub Profile
conn.executemany('insert into houses (field1, sqft, bdrms, age, price) values (?, ?, ?, ?, ?)', field1, sqft, bdrms, age, price)
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.spekframework</groupId>
<artifactId>kotlin-spek-maven</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>Sample kotlin tests</name>
<url>http://github.com/spekframework/kotlin-spek-maven</url>
@raniejade
raniejade / ThinkSpec.kt
Last active June 9, 2017 02:55 — forked from robfletcher/ThinkSpec.kt
Example of trying to use `SubjectSpek` and `itBehavesLike` if the subject requires a collaborator
import org.jetbrains.spek.api.dsl.describe
import org.jetbrains.spek.api.dsl.given
import org.jetbrains.spek.api.dsl.it
import org.jetbrains.spek.api.dsl.on
import org.jetbrains.spek.subject.SubjectSpek
import org.jetbrains.spek.subject.itBehavesLike
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
interface Collaborator: () -> Unit {
bucket: Map<Bits, IntArray> = ...
fun getEntities(aspect: Aspect): IntArray {
var result = HashMap<Bits, IntArray>()
// 1st pass, "allOf"
if (aspect.required == Bits.ZERO) {
result.addAll(bucket)
} else {
bucket.forEach { (bits, entities) ->
#include <iostream>
#include <conio.h>
using namespace std;
void main() {
// letters[0] => 'A' ... letters[25] => 'Z'
int letters[26];
bool lettersIsDisplayed[26];
// numbers[0] => 0 .. numbers[9] => 9
int numbers[10];
Toolkit xToolkit = Toolkit.getDefaultToolkit();
java.lang.reflect.Field awtAppClassNameField =
xToolkit.getClass().getDeclaredField("awtAppClassName");
awtAppClassNameField.setAccessible(true);
awtAppClassNameField.set(xToolkit, applicationName)
#bs {
.bootstrap() {
@import "bootstrap.less";
}
}
public class Foo {
private Bar bar;
public Foo() {
// call to new omitted
}
}
public class Bar {
private int x;
public class Foo {
private Bar bar;
public Foo() {
bar = new Bar(1, 2);
}
}
public class Bar {
private int x;