This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getParameterByName(name, url) { | |
if (!url) { | |
url = window.location.href; | |
} | |
name = name.replace(/[\[\]]/g, "\\$&"); | |
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), | |
results = regex.exec(url); | |
if (!results) return null; | |
if (!results[2]) return ''; | |
return decodeURIComponent(results[2].replace(/\+/g, " ")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var BrowserDetect = { | |
init: function () { | |
this.browser = this.searchString(this.dataBrowser) || "Other"; | |
this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "Unknown"; | |
}, | |
searchString: function (data) { | |
for (var i = 0; i < data.length; i++) { | |
var dataString = data[i].string; | |
this.versionSearchString = data[i].subString; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// For DB | |
$startDate = Carbon::createFromFormat('d F, Y', $data['start_date'], 'Africa/Johannesburg'); | |
$startDate->setTime($data['start_hour'], $data['start_minute'], 00); | |
$startDate->setTimeZone('UTC'); | |
//For UI | |
$startDate = new Carbon($event->start_date); | |
$startDate->timeZone('Africa/Johannesburg')->format('d-m-Y - H:i:s'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class compareImages | |
{ | |
private function mimeType($i) | |
{ | |
/*returns array with mime type and if its jpg or png. Returns false if it isn't jpg or png*/ | |
$mime = getimagesize($i); | |
$return = array($mime[0],$mime[1]); | |
switch ($mime['mime']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
adb: implement "adb reverse <local> <remote>" | |
This implements the logical opposite of 'adb forward', i.e. | |
the ability to reverse network connections from the device | |
to the host. | |
This feature is very useful for testing various programs | |
running on an Android device without root or poking at the | |
host's routing table. | |
Options and parameters are exactly the same as those for |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
DB::enableQueryLog(); | |
DB::listen( | |
function ($sql, $bindings, $time) { | |
// $sql - select * from `ncv_users` where `ncv_users`.`id` = ? limit 1 | |
// $bindings - [5] | |
// $time(in milliseconds) - 0.38 | |
dd($sql); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String dtStart = "2010-10-15T09:27:37Z"; | |
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); | |
try { | |
Date date = format.parse(dtStart); | |
System.out.println(date); | |
} catch (ParseException e) { | |
// TODO Auto-generated catch block | |
e.printStackTrace(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd",Locale.US); | |
String expiryDateString = simpleDateFormat.format(Date); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.valign-wrapper { | |
display: -webkit-flex; | |
display: -ms-flexbox; | |
display: flex; | |
-webkit-align-items: center; | |
-ms-flex-align: center; | |
align-items: center; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Uri outputFileUri; | |
private void openImageIntent() { | |
// Determine Uri of camera image to save. | |
final File root = new File(Environment.getExternalStorageDirectory() + File.separator + "MyDir" + File.separator); | |
root.mkdirs(); | |
final String fname = Utils.getUniqueImageFilename(); | |
final File sdImageMainDirectory = new File(root, fname); | |
outputFileUri = Uri.fromFile(sdImageMainDirectory); |