Skip to content

Instantly share code, notes, and snippets.

@pipiscrew
pipiscrew / login.java
Last active March 5, 2016 11:13
[android] Login Pattern with MySQL + APK Sign Verification
//control the application from server, new version is out? update the mysql_table, oldversion users cant sign in!
//your APK cracked? users cant login without a valid APK sign
String sign = "";
String version = "";
PackageInfo info;
try {
info = getPackageManager().getPackageInfo(getPackageName(), PackageManager.GET_SIGNATURES);
version = String.valueOf(info.versionCode); //ref : line 70
@pipiscrew
pipiscrew / call method exists in fragment from actionbar settings.java
Last active April 12, 2016 18:51
[Actiobar] settings menu - call method in fragment
//source - http://stackoverflow.com/a/22182746/1320686
//the activity_main.xml
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Framelayout to display Fragments -->
<FrameLayout
@pipiscrew
pipiscrew / WLGenLicenseDynSmartKey.cs
Last active January 31, 2016 15:53
Winlicense - WLGenLicenseDynSmartKey Call ASP.NET
<%@ Page Language="C#" %>
<%@ import Namespace="System.Runtime.InteropServices" %>
<script runat="server">
/******************************************************************
WLGenLicenseSmartKey rev1 - sample code contributed by Sanjay Kanade, AvniTech.com in 2008.
WLGenLicenseDynSmartKey rev2- sample code by PipisCrew in 2016
You are responsible for making any changes, testing and using it as per your
requirement. The author assumes no responsibility for any bugs or problems
arising from the use of the code.
@pipiscrew
pipiscrew / rand_soldiers.pas
Created November 5, 2015 17:06
Turbo Pascal - Randomize Soldiers
program Rand;
uses
crt;
var
menuChoice : integer;
soldArray : array[1..100,1..2] of integer;
RANDres : integer;
soldiersCount : Integer;
@pipiscrew
pipiscrew / config_pdo.php
Last active February 6, 2017 18:38
PDO Custom Class
<?php
function connect_mysql() {
$mysql_hostname = "localhost";
$mysql_user = "x";
$mysql_password = "x";
$mysql_database = "x";
$dbh = new PDO("mysql:host=$mysql_hostname;dbname=$mysql_database", $mysql_user, $mysql_password,
array(
@pipiscrew
pipiscrew / class_sort.cs
Created August 16, 2015 15:15
Class Sort
public class Person {
public string FirstName { get; set; }
public string LastName { get; set; }
}
// IN FORM - Create a list of people
List<Person> people = new List<Person>();
people.Add(new Person() { FirstName = "Gottfried", LastName = "Leibniz" });
people.Add(new Person() { FirstName = "Marie", LastName = "Curry" });
@pipiscrew
pipiscrew / multi_select.php
Last active August 29, 2015 14:26
using davidstutz bootstrap-multiselect via PHP
//more simply examples http://www.pipiscrew.com/2015/06/bootstrap-select-mutliselect/
////////////////////////[index.php]
<?php
//convert recordset to 1D array (will use it, to mark the multi-selects @ JS)
function get_array_by_set($db_set)
{
$rec_children = array();
foreach($db_set as $row) {
$rec_children[]= $row[0];
@pipiscrew
pipiscrew / UTC_Calcs.js
Last active August 29, 2015 14:26
UTC Calcs
<!-- http://www.pipiscrew.com/2015/08/js-utc-calcs/ -->
<script>
$(function () {
//init with date now
$("[name=post_date]").val(date_formatter(new Date()));
//edit button - read record
function query_POSTS_modal(rec_id){
@pipiscrew
pipiscrew / pass_PHP_mySQL_recordset_to_Javascript.js
Created June 23, 2014 12:07
[php+js] pass PHP mySQL recordset to Javascript
<?php
session_start();
if (!isset($_SESSION["x"])) {
header("Location: index.html");
exit ;
}
if (isset($_GET["id"])) {
@pipiscrew
pipiscrew / sort_list_t.java
Created June 16, 2014 13:12
[android] Sort List<t>
//at activity
List<TestItem> rowItems = new ArrayList<TestItem>();
TestItem rec;
for (DataSnapshot snapshot : arg0.getChildren()) {
rec = new TestItem();
rec.setID(snapshot.getRef().getName());