Skip to content

Instantly share code, notes, and snippets.

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

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.

@cainus
cainus / GForm.jsx
Created January 6, 2015 19:35
GForm.jsx
/** @jsx React.DOM */
var _ = require('lodash');
var React = require('react');
var GForm = React.createClass({
render: function() {
return (
<form onSubmit={this.onSubmit}>
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 January 6, 2011 23:34
To ORM or not to ORM
//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);';