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
function getElementByXpath(path) { | |
return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; | |
} | |
console.log( getElementByXpath("//html[1]/body[1]/div[1]") ); |
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
val jodaDateTimeConverter = new FormConverter[DateTime] { | |
override def serialize(v: Any): String = | |
new DateTime(v).toString(ISODateTimeFormat.dateHourMinuteSecond) | |
override def deserialize(s: String): DateTime = | |
new DateTime(s.toLong) | |
} | |
FormConverter.register(classOf[DateTime], jodaDateTimeConverter) | |
ClassInfo.factories.register(classOf[DateTime], {() => DateTime.now.asInstanceOf[AnyRef]}) |
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 com.github.aselab.activerecord.{PlayConfig, ActiveRecordTables} | |
import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach} | |
import play.api.Play | |
import play.api.test.FakeApplication | |
trait ActiveRecordAutoRollback extends BeforeAndAfterEach with BeforeAndAfterAll { | |
self: ApiBaseSpec => | |
def schema: Seq[ActiveRecordTables] = Seq(ActiveRecordTables.find("models.Tables")) |
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
/* | |
* Assuming we have some object with properties and methods | |
*/ | |
var me = { | |
first_name: 'Ahikar', | |
last_name: 'Grilka', | |
race: 'Klingon', | |
email: 'AhikarGrilka@jourrapide.com', | |
occupation: 'Commander of Defence', | |
greet: function(other_person){ |
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 es.cloudey.pagespeed.util; | |
import java.util.HashMap; | |
import java.util.Map; | |
import android.os.Bundle; | |
import android.os.Parcelable; | |
public class CollectionUtils { | |
public static Bundle toBundle(Map<String, ? extends Parcelable> input) { |
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
Regex for matching ALL Japanese common & uncommon Kanji (4e00 – 9fcf) ~ The Big Kahuna! | |
([一-龯]) | |
Regex for matching Hirgana or Katakana | |
([ぁ-んァ-ン]) | |
Regex for matching Non-Hirgana or Non-Katakana | |
([^ぁ-んァ-ン]) | |
Regex for matching Hirgana or Katakana or basic punctuation (、。’) |
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
// Create the Global class in your /app folder root package: | |
import play.api.{GlobalSettings, Play} | |
import play.api.Play.current | |
import play.api.mvc._ | |
import scala.concurrent.Future | |
import scala.concurrent.ExecutionContext.Implicits.global | |
/** |
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
buildscript { | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
classpath 'com.android.tools.build:gradle:0.12.+' | |
} | |
} |
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
buildscript { | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
classpath 'com.android.tools.build:gradle:0.12.+' | |
} | |
} |
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
<EditText | |
android:id="@+id/my_edit_text" | |
... | |
android:background="@drawable/some_bg" | |
android:textCursorDrawable="@null" /> |