Skip to content

Instantly share code, notes, and snippets.

@rkhmelyuk
rkhmelyuk / gist:942492
Created April 26, 2011 15:31
lftp to upload a file to FTP
lftp -u $FTP_USERNAME,$FTP_PASSWORD $FTP_SERVER/$FTP_DIRECTORY -e 'put -a filename;quit'
@rkhmelyuk
rkhmelyuk / clean_cache.sql
Created May 2, 2011 09:42
Clean MySQL cache
flush tables;
reset query cache;
a = null
b = 12
println "a.compareTo(b) = " + (a <=> b)
println "a.compareTo(a) = " + (a <=> a)
println "b.compareTo(b) = " + (b <=> b)
class Person {
String firstName
String lastName
int age
}
class Person implements Comparable<Person> {
String firstName
String lastName
int age
int compareTo(Person other) {
...
}
}
int compareTo(Person other) {
if (other == null) {
return 1;
}
int result = 0;
if (this.age > other.age) {
result = 1;
}
else if (this.age < other.age) {
int compareTo(Person other) {
age <=> other.age ?: lastName <=> other.lastName ?: firstName <=> other.firstName
}
def john = new Person(firstName: 'John', lastName: 'Doe', age: 25)
def mark = new Person(firstName: 'Mark', lastName: 'White', age: 25)
print "john <=> mark = " + (john <=> mark)
@rkhmelyuk
rkhmelyuk / about.md
Created August 14, 2011 19:41 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@rkhmelyuk
rkhmelyuk / max.scm
Created September 20, 2011 19:42
list of 2 max values of 3
(define (max x y z)
(define a (if (> x y) x y))
(define c (if (> x y) y x))
(define b (if (> c z) c z))
(list a b))