Skip to content

Instantly share code, notes, and snippets.

Matthew Morrone matthewmorrone

Block or report user

Report or block matthewmorrone

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@matthewmorrone
matthewmorrone / wheel-events.js
Created Jan 17, 2020
specific wheel up and down events
View wheel-events.js
window.addEventListener('wheel', function(e){
wDelta = e.wheelDelta < 0
? this.dispatchEvent(new Event('wheeldown'))
: this.dispatchEvent(new Event('wheelup'))
})
$(function() {
$(window).on("wheeldown", function(e) {
View normalize.java
public String normalize(String text) {
return text.replaceAll("[ÀÁÂÃÄÅĀĂĄḀẠẢẤẦẨẪẬẮẰẲẴẶǍǺȦȀȂǞǠǢǼ]", "A")
.replaceAll("[àáâãäåāăąḁạảấầẩẫậắằẳẵặẚǎǻȧȁȃǟǡǣǽ]", "a")
.replaceAll("[ḂḄḆ]", "B")
.replaceAll("[ḃḅḇ]", "b")
.replaceAll("[ḉćĉċč]", "c")
.replaceAll("[ḈĆĈĊČ]", "C")
.replaceAll("[ḋḍḏḑḓď]", "d")
.replaceAll("[ḊḌḎḐḒĎ]", "D")
View phone-input-helper.js
$(function() {
$("input").keyup(function(e) {
if ($(this).val().length >= 3 && e.which >= 48 && e.which <= 57) {
$(this).next('input').focus();
}
});
});
View aUI.csv
Meaning Letter IPA
Space a /a/
Movement e /ɛ/
Light i /ɪ/
Life o /ɔ/
Human u /ʊ/
Time A /ä/
Matter E /e/
Sound I /i/
Feeling O /o/
View primes.csv
Substantives I/you/someone/people/something/thing/body
Relational substantives Kind/part
Determiners This/the same/other~else~another
Quantifiers One/two/some/all/much/many/little/few
Evaluators Good/bad
Descriptors Big/small
Mental predicates Think/know/want/don't want/feel/see/hear
Speech Say/words/true
Actions/events/movement Do/happen/move
Existence/possession Be (somewhere)/there is/be (someone/something)/is) mine
@matthewmorrone
matthewmorrone / sudoku.js
Last active Jan 3, 2020
nyt updated their sudoku implementation
View sudoku.js
// console.clear();
var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
setTimeout(main, 1000);
Object.defineProperty(Object.prototype, "define", {
writable: false,
enumerable: false,
configurable: true,
View isTablet.java
public static boolean isTablet(Context context) {
return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}
@matthewmorrone
matthewmorrone / info.java
Created Nov 12, 2019
Show Android device name, model, version code, version name
View info.java
String device = Build.BRAND + " " + android.os.Build.MODEL;
String osInt = "Android " + android.os.Build.VERSION.SDK_INT;
String osRelease = "Android " + Build.VERSION.RELEASE;
Log.e("TAG", "Device: " + device + " " + osInt + " - " + osRelease);
@matthewmorrone
matthewmorrone / alert.java
Created Nov 12, 2019
show alert dialog from anywhere
View alert.java
new AlertDialog.Builder(getActivity())
.setTitle(getString(R.string.dialog_title))
.setMessage(getString(R.string.dialog_text))
.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// OK clicked
}
})
View getInputStreamFromUrl.java
public static InputStream getInputStreamFromUrl(String url) {
InputStream content = null;
try {
HttpClient httpclient = new DefaultHttpClient();
HttpResponse response = httpclient.execute(new HttpGet(url));
content = response.getEntity().getContent();
} catch (Exception e) {
Log.("[GET REQUEST]", "Network exception", e);
}
return content;
You can’t perform that action at this time.