View NativeDll.cs
class NativeDLL : DllLoader
{
private delegate string MyNativeMethod();
public NativeDLL(string dllPath)
: base(dllPath) { }
internal string Hello()
{
var method = this.LoadFunction<MyNativeMethod>("Hello");
View CopyOf
import java.util.*;
import static java.lang.System.*;
public class CopyOf{
public static int[] copyOf(int[] arr){
int blah[] = new int[arr.length];
for(int i = 0; i < arr.length; i++){
blah[i] = arr[i];
}
return blah;
}
View Translate.xaml
<ContentPage.Resources>
<ResourceDictionary>
<xamanimation:StoryBoard
x:Key="LogoAnimation"
Target="{x:Reference Logo}">
<xamanimation:TranslateToAnimation TranslateY="180" TranslateX="95" Duration="750" />
<xamanimation:TranslateToAnimation TranslateY="-180" TranslateX="-95" Duration="750" />
<xamanimation:TranslateToAnimation TranslateY="0" TranslateX="0" Duration="750" />
</xamanimation:StoryBoard>
</ResourceDictionary>
View DllLoader.cs
internal abstract class DllLoader : IDisposable
{
[DllImport("kernel32.dll")]
private static extern IntPtr LoadLibraryEx(string dllToLoad, IntPtr hFile, LoadLibraryFlags flags);
[DllImport("kernel32.dll")]
private static extern IntPtr GetProcAddress(IntPtr hModule, string procedureName);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool FreeLibrary(IntPtr hModule);
View Book Store
import java.util.*;
class Book {
private String bookTitle;
private String bookAuthor;
private String bookISBN;
private int bookCopies;
Book() {
View OpenTracingThreadPropagation.scala
class OpenTracingThreadPropagation(tracer: Tracer) extends ThreadPropagation[Span] {
val scopeManager = tracer.scopeManager()
// captures the span at the call site
override def captureThreadState(): Span = tracer.activeSpan()
// copies the span into the new thread being spawned
override def wrapWithState(runnable: Runnable, state: Span): Runnable = new Runnable {
override def run(): Unit = {
View Banking System
import java.util.Random;
import java.util.Scanner;
import static java.lang.System.out;
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
class Account{
private String accountHolderName;
View MainCanvas.java
import android.Manifest;
import android.app.Activity;
import android.content.pm.PackageManager;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.drawable.BitmapDrawable;
import android.os.Build;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
View gist:c7a66de11b29342c854adb3f61da8fcf
install PostgreSQL 9 in Mac OSX via Homebrew
Mac OS X Snow Leopard
System Version: Mac OS X 10.6.5
Kernel Version: Darwin 10.5.0
Install notes for PostgreSQL 9.0.1 install using Homebrew:
sh-3.2# brew install postgresql
View App.vue
<template>
<view class="container">
<view class="main">
<text-input />
</view>
</view>
</template>
<script>
import TextInput from './src/TodoInput';