Skip to content

Instantly share code, notes, and snippets.

View Blasanka's full-sized avatar
🚀
Flutter dev

B Liyanage Asanka Blasanka

🚀
Flutter dev
View GitHub Profile
@Blasanka
Blasanka / Example.java
Last active June 6, 2017 16:50
This is the main file(Example.java) and the second class called "ChildExample.java". Both are in this file you have to divide to two java files.
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class Example {
private JFrame frame;
@aruld
aruld / RideTest.java
Created January 11, 2018 03:06
Local Variable Type involving lambda
import java.util.Comparator;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Stream;
public class RideTest {
interface RideProvider {
long getFareEstimate(String start_lat, String start_lng, String end_lat, String end_lng, String type);
}
@chrisma
chrisma / neo4j_cheatsheet.md
Last active October 1, 2019 16:18
Neo4J cheatsheet

Neo4J Cheatsheet

Refcard

http://neo4j.com/docs/2.1/cypher-refcard/

Database Exploration

List all labels of a node

labels(n)

List all node labels (and count them)

MATCH n

RETURN distinct labels(n), count(n) as count_n

@aruld
aruld / foreachmap.dart
Created October 19, 2011 18:29
Dart forEach() on a Map
main() {
Map<String, int> map = {
'one': 1,
'two': 2,
'twelve': 12};
void iterateMapEntry(key, value) {
map[key] = value;
print('$key:$value');//string interpolation in action
}
@basavesh
basavesh / DoublyLinkedList.java
Created November 9, 2012 08:35
DoublyLinkedList.java
package edu.cmu.cs771.hw1;
/**
* This class implements a doubly linked list of characters in Java.
* The instance variables head and tail are initially null.
* As elements are added head points to the first element on the list and tail points to the last element. Each node on the list is of type DoubleNode.
* Each DoubleNode holds a pointer to the previous node and a pointer to the next node in the list.
* @author songluo
*
*/
@whitfin
whitfin / WriteObjectFile.java
Created January 28, 2014 21:07
Simple class to write a JSON object to a file, and read it back into JSON. Useful for data storing on Android.
package com.zackehh.example;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import android.content.Context;
anonymous
anonymous / activity_main.xml
Created April 8, 2015 22:18
RelativeLayout XML for Udacity quiz question
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">
<TextView
android:text="I’m in this corner"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
/**
* This method displays the given price on the screen.
*/
private void displayPrice(int number) {
TextView priceTextView = (TextView) findViewById(R.id.price_text_view);
priceTextView.setText(NumberFormat.getCurrencyInstance().format(number));
}
@aponxi
aponxi / sql-mongo_comparison.md
Last active February 21, 2024 11:56
MongoDb Cheat Sheets

SQL to MongoDB Mapping Chart

SQL to MongoDB Mapping Chart

In addition to the charts that follow, you might want to consider the Frequently Asked Questions section for a selection of common questions about MongoDB.

Executables

The following table presents the MySQL/Oracle executables and the corresponding MongoDB executables.

@ericwindmill
ericwindmill / form_page.dart
Created April 14, 2018 19:25
Flutter Simple inherited Widget Example
import 'package:flutter/material.dart';
import 'package:simple_inherit/state_container.dart';
class UpdateUserScreen extends StatelessWidget {
static final GlobalKey<FormState> formKey = new GlobalKey<FormState>();
static final GlobalKey<FormFieldState<String>> firstNameKey =
new GlobalKey<FormFieldState<String>>();
static final GlobalKey<FormFieldState<String>> lastNameKey =
new GlobalKey<FormFieldState<String>>();
static final GlobalKey<FormFieldState<String>> emailKey =