Skip to content

Instantly share code, notes, and snippets.

View nasznjoka's full-sized avatar

nasznjoka nasznjoka

View GitHub Profile
@nasznjoka
nasznjoka / README.md
Created July 8, 2019 08:51 — forked from denji/README.md
Remove/Backup – settings & cli for macOS (OS X) – DataGrip, AppCode, CLion, Gogland, IntelliJ, PhpStorm, PyCharm, Rider, RubyMine, WebStorm
@nasznjoka
nasznjoka / BottomSheetFragment.java
Created May 11, 2017 14:38 — forked from cutiko/BottomSheetFragment.java
Simple template to create an Android Bottom Sheet navigation
public class BottomSheetFragment extends Fragment {
private BottomSheetBehavior sheetBehavior;
public BottomSheetFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
@nasznjoka
nasznjoka / AesEncryptDecrypt.java
Created August 27, 2016 10:02 — forked from KushtrimPacaj/AesEncryptDecrypt.java
AES encryption in Java, equivalent of Crypt ( Encrypter.php class ) on Laravel (PHP)
import android.util.Base64;
import android.util.Log;
import com.google.gson.Gson;
import org.apache.commons.codec.binary.Hex;
import java.io.UnsupportedEncodingException;
import java.security.GeneralSecurityException;
import java.security.Key;
import java.util.Arrays;
import javax.crypto.Cipher;
import javax.crypto.Mac;
@nasznjoka
nasznjoka / cryptographically_secure_random_strings.php
Created June 29, 2016 10:07 — forked from raveren/cryptographically_secure_random_strings.php
Generate cryptographically secure random strings. Based on Kohana's Text::random() method and this answer:http://stackoverflow.com/a/13733588/179104
function random_text( $type = 'alnum', $length = 8 )
{
switch ( $type ) {
case 'alnum':
$pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
break;
case 'alpha':
$pool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
break;
case 'hexdec':
@nasznjoka
nasznjoka / gist:078ed3a8bdcd83efce5f
Created January 20, 2016 10:01 — forked from prime31/gist:5675017
Simple PHP script showing how to send an Android push notification. Be sure to replace the API_ACCESS_KEY with a proper one from the Google API's Console page. To use the script, just call scriptName.php?id=THE_DEVICE_REGISTRATION_ID
<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array