Skip to content

Instantly share code, notes, and snippets.

<form enctype="multipart/form-data">
<input name="file" type="file" />
<input type="button" value="Upload" />
</form>
<progress></progress>
<script
src="http://code.jquery.com/jquery-1.12.4.min.js"
integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ="
crossorigin="anonymous"></script>
<script type="text/javascript">
<div id="series"></div>
<script type="text/javascript">
class Series
{
constructor(start, end)
{
this.error = "";
this.success = "";
start = this.validate(parseInt(start), 'start');
end = this.validate(parseInt(end), 'end');
$root=(isset($_SERVER["HTTPS"]) ? "https://" : "http://").$_SERVER["HTTP_HOST"];
$root.= str_replace(basename($_SERVER["SCRIPT_NAME"]), "", $_SERVER["SCRIPT_NAME"]);
$config["base_url"] = $root;
$('#checkAll').click(function(){
var checked =$(this).prop('checked');
$('input:checkbox').prop('checked', checked);
});
$('body').on('click', 'input:checkbox', function() {
if(!this.checked) {
$('#checkAll').prop('checked', false);
}
else {
var numChecked = $('input:checkbox:checked:not(#checkAll)').length;
<?php
$count = array(0=>0,1=>0,2=>0,3=>0,4=>0);
$inputs = array(
0 => '00001',
1 => '00011',
2 => '01110',
3 => '00110',
4 => '00000'
);
<?php
$text = "The quick brown fox jumps over the lazy dog!";
$text = strtolower($text);
$characters = array('a'=>0,'b'=>0,'c'=>0,'d'=>0,'e'=>0,'f'=>0,'g'=>0,'h'=>0,'i'=>0,'j'=>0,'k'=>0,'l'=>0,'m'=>0,'n'=>0,'o'=>0,'p'=>0,'q'=>0,'r'=>0,'s'=>0,'t'=>0,'u'=>0,'v'=>0,'w'=>0,'x'=>0, 'y'=>0,'z'=>0);
if ($text != " " && strlen($text) <= 200)
{
for ($i=0; $i<strlen($text); $i++)
{
if (in_array($text[$i], $characters)){
@souravmsh
souravmsh / SQL – left join on first or last record in the right table
Last active December 22, 2018 09:06
SQL – left join on first or last record in the right table
SELECT s1.hr_shift_id, u.hr_unit_name
FROM hr_shift s1
LEFT JOIN hr_shift s2
ON (s1.hr_shift_name = s2.hr_shift_name AND s1.hr_shift_id < s2.hr_shift_id)
LEFT JOIN hr_unit AS u
ON u.hr_unit_id = s1.hr_shift_unit_id
WHERE s2.hr_shift_id IS NULL
<div class="col-sm-4">
<div class="form-group">
<label class="col-sm-3 control-label" for="year"> Year </label>
<div class="col-sm-9">
<input type="text" name="year" id="year" class="form-control currentYearPicker" value="2018" placeholder="Year" data-validation="required" autocomplete="off" />
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label" for="month"> Month </label>
<?php
function checkPasswordStrength($password, $grade = 3, $info = NULL, $file = NULL, $ci = true){
if ( empty($password) ){
return false;
}
$grade = intval($grade);
if ( $grade < 1 ){
return false;
}
$info = empty($info) ? NULL : $info;
<?php
/*
* Detect Where the Script is Running (Suffix = S for Server/ L for Local)
* ID generated by microtime()
*/
class Generate
{
private $ip = array('127.0.0.1', '::1', 'localhost');