Skip to content

Instantly share code, notes, and snippets.

View tediscript's full-sized avatar
🎯
Focusing

Alfredo Pareto tediscript

🎯
Focusing
View GitHub Profile
@tediscript
tediscript / email_validator_regex.sh
Created July 6, 2018 01:03 — forked from guessi/email_validator_regex.sh
Simple Email Validator in Bash
#!/bin/bash
validator() {
printf "* %-48s" "$1"
echo "$1" | egrep --quiet "^([A-Za-z]+[A-Za-z0-9]*((\.|\-|\_)?[A-Za-z]+[A-Za-z0-9]*){1,})@(([A-Za-z]+[A-Za-z0-9]*)+((\.|\-|\_)?([A-Za-z]+[A-Za-z0-9]*)+){1,})+\.([A-Za-z]{2,})+"
[ $? -eq 0 ] && printf "\e[1;32m[pass]\e[m" || printf "\e[1;31m[fail]\e[m"
echo
}
echo
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>JSend</title><link rel="start" href="/labs/jsend/wiki" /><link rel="search" href="/labs/jsend/search" /><link rel="help" href="/labs/jsend/wiki/TracGuide" /><link rel="stylesheet" href="/labs/css/trac.css" type="text/css" /><link rel="stylesheet" href="/labs/css/wiki.css" type="text/css" /><link rel="icon" href="/favicon.ico" type="image/x-icon" /><link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" /><link rel="alternate" href="/labs/jsend/wiki/WikiStart?format=txt" title="Plain Text" type="text/x-trac-wiki" /><style type="text/css">
</style>
<script type="text/javascript" src="/labs/js/trac.js"></script>
</head>
= JSend =
* '''What?''' - Put simply, JSend is a specification that lays down some rules for how [http://json.org JSON] responses from web servers should be formatted. JSend focuses on application-level (as opposed to protocol- or transport-level) messaging which makes it ideal for use in [http://en.wikipedia.org/wiki/Representational_State_Transfer REST]-style applications and APIs.
* '''Why?''' - There are lots of web services out there providing JSON data, and each has its own way of formatting responses. Also, developers writing for JavaScript front-ends continually re-invent the wheel on communicating data from their servers. While there are many common patterns for structuring this data, there is no consistency in things like naming or types of responses. Also, this helps promote happiness and unity between backend developers and frontend designers, as everyone can come to expect a common approach to interacting with one another.
* '''Hold on now, aren't there already specs for this kind of thi
@tediscript
tediscript / referee.js
Last active August 29, 2015 14:02
Penalty Blox modification to enable keyword filter
// Handle sending offenders off to the box where they will feel shame.
// Modified now support #hashtag, @username and keywords
// Original file at https://github.com/jeffreyiacono/penalty-blox/blob/master/js/referee.js
function Referee() {
return this;
}
/**
* use background / extension messaging to bridge popup with localStore
* get all penalty boxed entries and remove them along with settings
public class FullScreen extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
<EditText
android:id="@+id/EditText02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="5"
android:gravity="top|left"
android:inputType="textMultiLine"
android:scrollHorizontally="false"
/>
android:isIndicator="true"
package com.tediscript.android;
import android.content.Context;
import android.content.SharedPreferences;
public class Settings {
public static String PREFS_NAME = "com.tediscript.android.settings";
public static void putString(Context ctx, String key, String value) {
android.os.Process.killProcess(android.os.Process.myPid());