This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: UTF-8 -*- | |
# vim: ai ts=4 sts=4 et sw=4 | |
# Autor: Hector Miuler Malpica Gallegos | |
# Email: miuler@gmail.com | |
# Rev: $Rev | |
# ------------------------------------------------------------------- | |
# https://wiki.ubuntu.com/DesktopExperienceTeam/ApplicationIndicators | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import play.api.libs.json._ | |
import play.api.libs.functional.syntax._ | |
import play.api.data.validation._ | |
implicit def tuple2Reads[A, B](implicit aReads: Reads[A], bReads: Reads[B]): Reads[Tuple2[A, B]] = Reads[Tuple2[A, B]] { | |
case JsArray(arr) if arr.size == 2 => for { | |
a <- aReads.reads(arr(0)) | |
b <- bReads.reads(arr(1)) | |
} yield (a, b) | |
case _ => JsError(Seq(JsPath() -> Seq(ValidationError("Expected array of two elements")))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.collection._ | |
import com.twitter.util._ | |
scala> val buffer = mutable.ArrayBuffer.empty[Int] | |
scala> println(Time.measure { (0 to 50000000).foreach { buffer += _ } }.inMillis) | |
17610 | |
scala> var vector = immutable.Vector.empty[Int] | |
scala> println(Time.measure { (0 to 50000000).foreach { vector :+= _ } }.inMillis) | |
7865 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LOG_COMPLETO | |
/home/miuler/java/apache-tomcat-6.0.36/bin/catalina.sh run | |
Using CATALINA_BASE: /home/miuler/.IntelliJIdea12/system/tomcat/Unnamed_dsm-webapp | |
Using CATALINA_HOME: /home/miuler/java/apache-tomcat-6.0.36 | |
Using CATALINA_TMPDIR: /home/miuler/java/apache-tomcat-6.0.36/temp | |
Using JRE_HOME: /usr/lib/jvm/java-6-openjdk | |
Using CLASSPATH: /home/miuler/java/apache-tomcat-6.0.36/bin/bootstrap.jar | |
[2013-03-20 01:42:25,743] Artifact dsm-webapp:war exploded: Server is not connected. Press 'Deploy' to start deployment. | |
Connected to the target VM, address: '127.0.0.1:55706', transport: 'socket' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The basic idea here is to substantiate the claims made by this square post: | |
http://corner.squareup.com/2011/06/postgresql-data-is-important.html | |
In PostgreSQL, and MySQL (MyISAM and InnoDB) I create millions of rows and then add | |
and remove columns and add and remove indexes. For columns without defaults this is | |
basically free in PostgreSQL and O(n) in MySQL. For adding indexes its at best O(n) | |
everywhere, but with PostgreSQL it claims not to do any locking that would otherwise | |
prevent table interaction. | |
Also, PostgreSQL has _awsome_ documentation (it has real examples!). I always get |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package jmeter | |
import com.excilys.ebi.gatling.core.Predef._ | |
import com.excilys.ebi.gatling.http.Predef._ | |
import com.excilys.ebi.gatling.http.Headers.Names._ | |
import bootstrap._ | |
class JMeterBenchmark extends Simulation { | |
def apply = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
verificar_hg() { | |
cd /home/miuler/aep-dsm/$1 | |
#mensaje=`hg -q in --template '{author|user} :: {desc|firstline|strip}\n------------------------------------------------------------\n'` | |
#mensaje=`hg in | tail -n +2` | |
mensaje=`hg in | tail -n +2|sed -r s/revision/---------------------------------------------\\\nrevision/` | |
if [ -n "$mensaje" ] | |
then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class OSValidator { | |
public static void main(String[] args) { | |
if (isWindows()) { | |
System.out.println("This is Windows"); | |
} else if (isMac()) { | |
System.out.println("This is Mac"); | |
} else if (isUnix()) { | |
System.out.println("This is Unix or Linux"); | |
} else if (isSolaris()) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The Objective | |
This language experiment was designed to show how parametric polymorphism and type classes are implemented in | |
different languages. The implementation languages where chosen out of personal preference. I am well aware it's not | |
complete and would love for you to help me with that. If you don't see your favorite language please add it as | |
a comment. I am also not an expert in all of these languages but did try to make them as idiomatic as possible. | |
If you believe there is a better solution please leave a comment with the implementation. | |
Personal Takeaways: | |
* ML based languages provide very terse and readable code, when compared to C based syntax. |