Skip to content

Instantly share code, notes, and snippets.

@cainus
cainus / gist:55593620add79d21dc8ff4fe1cd81674
Last active Jun 19, 2017 — forked from dodyg/gist:5823184
Kotlin Programming Language Cheat Sheet Part 1
View gist:55593620add79d21dc8ff4fe1cd81674

Intro

Kotlin is a new programming language for the JVM. It produces Java bytecode, supports Android and generates JavaScript. The latest version of the language is Kotlin M5.3

Kotlin project website is at kotlin.jetbrains.org.

All the codes here can be copied and run on Kotlin online editor.

Let's get started.

View GForm.jsx
/** @jsx React.DOM */
var _ = require('lodash');
var React = require('react');
var GForm = React.createClass({
render: function() {
return (
<form onSubmit={this.onSubmit}>
View the asdf stream
var util = require("util");
var Readable = require('readable-stream').Readable;
function TestStream(){
Readable.call(this); // kind of a big deal
}
util.inherits(TestStream, Readable);
TestStream.prototype._read = function(){
that.push("asdfasdfasdf");
@cainus
cainus / gist:768849
Created Jan 6, 2011
To ORM or not to ORM
View gist:768849
//SQL Way
//========================================
function getUnpublishedUsers(){
$sql = 'SELECT md.fname AS firstname, md.lname AS lastname, md.email AS email_address, statistics.profile_complited AS percent_complete
FROM maestro_details AS md, statistics
WHERE statistics.user_id = md.user_id
AND md.user_id NOT IN
(SELECT user_id FROM maestro_detail_publisheds);';