Skip to content

Instantly share code, notes, and snippets.

@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());
@pipiscrew
pipiscrew / firebase_login_with_token.js
Created June 16, 2014 13:08
[js] firebase - login with token
<script src="https://cdn.firebase.com/v0/firebase.js"></script>
<script type='text/javascript' src="https://cdn.firebase.com/v0/firebase-token-generator.js"></script>
var tokenGenerator = new FirebaseTokenGenerator("x");
var token = tokenGenerator.createToken({isModerator: true});
var dataRef = new Firebase("https://x.firebaseio.com/");
dataRef.auth(token, function(error) {
if(error) {
@pipiscrew
pipiscrew / flurry_read_event_variables.php
Last active August 29, 2015 14:02
[php] flurry read event variables
<?php
//used for defined array, used on functions
class RECORD {
public $date_rec;
public $sessionID;
public $event_name;
public $app_version;
public $app_platform;
public $device;