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
// | |
// RandomNames.swift | |
// | |
// Created by Lütfi Tekin on 27.12.2017. | |
// | |
class RandomNickNames{ | |
static let adjectiveList = ["aback","abaft","abandoned","abashed","aberrant","abhorrent","abiding","abject","ablaze","able","abnormal","aboard","aboriginal","abortive","abounding","abrasive","abrupt","absent","absorbed","absorbing","abstracted","absurd","abundant","abusive","acceptable","accessible","accidental","accurate","acid","acidic","acoustic","acrid","actually","ad","hoc","adamant","adaptable","addicted","adhesive","adjoining","adorable","adventurous","afraid","aggressive","agonizing","agreeable","ahead","ajar","alcoholic","alert","alike","alive","alleged","alluring","aloof","amazing","ambiguous","ambitious","amuck","amused","amusing","ancient","angry","animated","annoyed","annoying","anxious","apathetic","aquatic","aromatic","arrogant","ashamed","aspiring","assorted","astonishing","attractive","auspicious","automatic","available","average","awake","aware","awesome","awful","axiomatic","bad","barbarou |
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 static String shuffle(String string) { | |
StringBuilder sb = new StringBuilder(string.length()); | |
double rnd; | |
for (char c: string.toCharArray()) { | |
rnd = Math.random(); | |
if (rnd < 0.34) | |
sb.append(c); | |
else if (rnd < 0.67) | |
sb.insert(sb.length() / 2, c); | |
else |
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.content.Context | |
import android.content.SharedPreferences | |
import android.util.Log | |
private const val SHAREDPREF = "shared" | |
private const val FIRST_TIME = "firstime" |
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
<?php | |
if(preg_match_all('/\p{C}/u', $ty_json, $out, PREG_OFFSET_CAPTURE)) | |
{ | |
echo "<pre>\n"; | |
foreach($out[0] AS $k => $v) { | |
echo "detected ".bin2hex($v[0])." @ offset ".$v[1]."\n"; | |
} | |
echo "</pre>"; | |
} | |
//https://stackoverflow.com/a/15423899 |
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 builder = MaterialDatePicker.Builder.dateRangePicker() | |
val picker = builder.setTitleText("test").build() | |
picker.addOnPositiveButtonClickListener { | |
"picked $it" logWith "Log" | |
} | |
picker.show(supportFragmentManager,null) |
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 java.util.* | |
class ObservableList<T>(private val wrapped: MutableList<T>): MutableList<T> by wrapped, Observable() { | |
override fun add(element: T): Boolean { | |
if (wrapped.add(element)) { | |
setChanged() | |
notifyObservers() | |
return true | |
} | |
return 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
//under project level gradle | |
classpath 'org.codehaus.groovy.modules.http-builder:http-builder:0.5.2' | |
//app level gradle under android {} | |
def put = new URL("http://[hue bridge ip]/api/[hue username key]/lights/[light number]/state").openConnection(); | |
def message = '{"on": true,"xy":[0.400,0.922]}' | |
put.setRequestMethod("PUT") | |
put.setDoOutput(true) | |
put.setRequestProperty("Content-Type", "application/json") | |
put.getOutputStream().write(message.getBytes("UTF-8")) |