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
override def applyState[T](s: FragmentState[T]) = s match { | |
case OnCreateView(state, inflater, container) => s.applyResult( | |
l[ScrollView](l[LinearLayout]( | |
IO(generatedPassword) >>= k.text(generate(state)) >>= | |
k.textAppearance(getActivity, android.R.style.TextAppearance_Medium) >>= | |
k.gravity(Gravity.CENTER) >>= | |
k.backgroundColor(getResources.getColor(android.R.color.darker_gray)) >>= | |
lpK(MATCH_PARENT, 48.dp)(margins(bottom = 16.dp)), | |
IO(lengthLabel) >>= k.text(getString(R.string.minimum_length, state.length.asInstanceOf[Integer])), | |
IO(lengthSlider) >>= stdH >>= k.progress(state.length - 8) >>= |
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
from ctypes import * | |
from ctypes.wintypes import * | |
import hexchat | |
import traceback | |
import sys | |
__module_name__ = "sethook" | |
__module_version__ = "1.0" | |
__module_description__ = "Demonstration of calling SetWindowsLongPtr from ctypes" |
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
sealed trait CharType | |
case object Uppercase extends CharType | |
case object Lowercase extends CharType | |
case object Symbol extends CharType | |
case object Digit extends CharType | |
case class Spans(chartype: CharType, start: Int, end: Int) | |
if (Option(strings.Get(PwDefs.PasswordField)) exists (_.Length > 0)) { | |
val passfield = new StandardFieldView(this) | |
passfield.first = first | |
first = false |
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 com.hanhuy.android.irc | |
import android.app.Activity | |
import android.os.Bundle | |
import android.view.{View, Menu} | |
import iota.IO | |
/** beware: | |
* https://youtrack.jetbrains.com/issue/SCL-9888 | |
* https://issues.scala-lang.org/browse/SI-9658 |
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 com.hanhuy.android.irc | |
import android.graphics.Typeface | |
import android.os.Bundle | |
import android.support.v7.app.AppCompatActivity | |
import android.support.v7.widget.{LinearLayoutManager, RecyclerView} | |
import android.view.ViewGroup | |
import android.widget.{TextView, LinearLayout} | |
import com.hanhuy.android.irc.model.{MessageAdapter, RingBuffer} |
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 android.app.Activity | |
import android.os.Bundle | |
import ActivityStateMachine._ | |
/** | |
* @author pfnguyen | |
*/ | |
trait ActivityStateMachine[T <: State[T]] extends Activity { |
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
requestActivityResult(intent).onSuccessMain { case data => | |
val ringtone = data.?.map(_.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI): Uri) | |
setRingtone(ringtone.fold("")(_.toString)) | |
} |
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
[pfnguyen@GALACTICA output] $ ~/android-sdk-windows/build-tools/23.0.2/aapt.exe d xmltree keepshare-debug.apk AndroidManifest.xml | grep -A5 provider | |
E: provider (line=58) | |
A: android:label(0x01010001)=@0x7f070039 | |
A: android:name(0x01010003)="com.hanhuy.android.keepshare.SearchProvider" (Raw: "com.hanhuy.android.keepshare.SearchProvider") | |
A: android:readPermission(0x01010007)="android.permission.GLOBAL_SEARCH" (Raw: "android.permission.GLOBAL_SEARCH") | |
A: android:exported(0x01010010)=(type 0x12)0xffffffff | |
A: android:authorities(0x01010018)=@0x7f070093 | |
[pfnguyen@GALACTICA output] $ ~/android-sdk-windows/build-tools/23.0.2/aapt.exe d resources keepshare-debug.apk | grep 70093 | |
spec resource 0x7f070093 com.hanhuy.android.keepshare:string/search_suggest_authority: flags=0x40000000 | |
resource 0x7f070093 com.hanhuy.android.keepshare:string/search_suggest_authority: t=0x03 d=0x00000346 (s=0x0008 r=0x00) (PUBLIC) |
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
[pfnguyen@GALACTICA sbtm] $ sbt "keypath b/compile a/compile" | |
[info] Loading global plugins from C:\Users\pfnguyen\.sbt\0.13\plugins | |
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". | |
SLF4J: Defaulting to no-operation (NOP) logger implementation | |
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. | |
[info] Loading project definition from C:\Users\pfnguyen\src\sbtm\project | |
[info] Updating {file:/C:/Users/pfnguyen/src/sbtm/project/}sbtm-build... | |
[info] Resolving org.eclipse.jgit#org.eclipse.jgit.archive;3.7.0.201502260915-r [info] Resolving com.hanhuy.sbt#key-path;0.3-SNAPSHOT ... | |
[warn] Host repo.scala-sbt.org not found. url=https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.hanhuy.sbt/key-path/scala_2.10/sbt_0.13/0.3-SNAPSHOT/ivys/ivy.xml | |
[info] You probably access the destination server through a proxy server that is not well configured. |
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
def withSocketAsync[A](s: => Socket) | |
(f: (Socket,java.io.Reader,java.io.Writer) => A) | |
: Future[A] = { | |
val promise = Promise[A]() | |
val sock = s | |
async { | |
try { | |
val in = new InputStreamReader(sock.getInputStream, "utf-8") | |
val out = new OutputStreamWriter(sock.getOutputStream, "utf-8") | |
try { |