Skip to content

Instantly share code, notes, and snippets.

View pfieffer's full-sized avatar
🦉
Working :/

Ravi Garbuja Pun pfieffer

🦉
Working :/
View GitHub Profile
<?php
//For connecting the database-->
$link = mysqli_connect("localhost","root","", "practise");
if (!$link) {
die("Connection failed: " . mysql_error());
}else{
mysqli_select_db ($link, 'practise') or die ("Could not select database.");
}
//Start session
@pfieffer
pfieffer / DateTypeConverter.java
Last active November 1, 2019 06:55
Date object to Long (TImestamps) and vice versa on Android.
/**
* A utility class to convert date type from java.util.Date to Long and vice versa. This needs to be
* done to store/read the date into/from SQLite database.
*/
public class DateTypeConverter {
public static Date toDate(Long timestamp) {
return timestamp == null ? null : new Date(timestamp);
}
public static Long toTimestamp(Date date) {
<?php
//For connecting the database-->
$link = mysqli_connect("localhost","root","", "practise");
if (!$link) {
die("Connection failed: " . mysql_error());
}else{
mysqli_select_db ($link, 'practise') or die ("Could not select database.");
}
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/bootstap-theme.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap-theme.min.css">
</head>
<body>
<?php
//For connecting the database
$link = mysqli_connect("localhost","root","", "practise");
if (!$link) {
echo "Error: Unable to connect to MySQL." . PHP_EOL;
echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL;
echo "Debugging error: " . mysqli_connect_error() . PHP_EOL;
exit;
}
<?php
//For connecting the database
$link = mysqli_connect("localhost","root","", "practise");
if (!$link) {
echo "Error: Unable to connect to MySQL." . PHP_EOL;
echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL;
echo "Debugging error: " . mysqli_connect_error() . PHP_EOL;
exit;
}
<!DOCTYPE html>
<html>
<head>
<title>Sign up form</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/bootstap-theme.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap-theme.min.css">
</head>
<!--from scratch coding, here. -->
<!DOCTYPE html>
<html>
<head>
<title>Password Salting</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/bootstap-theme.css">
@pfieffer
pfieffer / Time12And24hrFormat.java
Created June 5, 2018 08:16
A function to convert 12 hr time in string format to 24 hr time in string format and vice versa
/**
*
* @param timeString A string value of time in 12 hr format
* @return A string value of time in 24 hr format
*/
private String getTimeIn24hrFormat(String timeString) {
DateFormat inFormat = new SimpleDateFormat( "hh:mm a");
/* This is a 24 hour date time format that we are using to convert all
* input date and time formats to this format.
*/
@pfieffer
pfieffer / CustomFontLoader.java
Created June 5, 2018 06:27
A utility class to load custom font from the assets/font folder on Views
public class CustomFontLoader {
public static final int FONT_NAME_1 = 0;
public static final int FONT_NAME_2 = 1;
private static final int NUM_OF_CUSTOM_FONTS = 2;
private static boolean fontsLoaded = false;
private static Typeface[] fonts = new Typeface[2];