Skip to content

Instantly share code, notes, and snippets.

@jquery404
jquery404 / Circular Image.html
Created October 18, 2018 04:44
get circular image for any size of picture
<style>
.circular {
width: 150px;
height: 150px;
border-radius: 50%;
position: relative;
overflow: hidden;
margin: 0 auto;
}
.circular img {
@jquery404
jquery404 / jqueryAngularDirective.html
Last active October 10, 2018 07:40
jQuery Plugin to Angular Directive
<input jqdaterangepicker type="text" class="form-control" ng-model="daterange" ng-change="onDateRangeChange()" />
<input
jqdatepicker
type="text"
name="dueStartDate"
datetime="dd-MM-yyyy"
data-date-format="dd-mm-yyyy"
class="form-control"
placeholder="Due Date (From)"
ng-model="selectedEdit.field" />
@jquery404
jquery404 / File Upload.html
Created September 14, 2018 04:06
File upload service for angularjs
<html>
<form ng-submit="SubmitAssignment()" enctype="multipart/form-data">
<div class="form-group">
<label class="control-label">Upload File</label>
<input type="file" file-model="myFile" />
</div>
<button class="btn btn-info" type="submit">Submit</button>
</form>
@jquery404
jquery404 / Pagination.html
Last active September 12, 2018 08:22
Angular and Bootstrap UI pagination
<div class="info">
Showing {{entryLimit*(currentPage-1)+1}} to {{entryLimit*(currentPage-1)+entryLimit}} of {{totalItems}} entries
</div>
<div ng-repeat="data in filtered = (activity) | startFrom:(currentPage-1)*entryLimit | limitTo:entryLimit">
<td>{{entryLimit *(currentPage-1)+$index+1}}</td>
</div>
<div
pagination
@jquery404
jquery404 / Distance.sql
Created July 6, 2018 06:26
Here's the SQL statement that will find the closest 20 locations that are within a radius of 25 miles to the 37, -122 coordinate. It calculates the distance based on the latitude/longitude of that row and the target latitude/longitude, and then asks for only rows where the distance value is less than 25, orders the whole query by distance, and l…
SELECT id, ( 3959 * acos( cos( radians(37) ) * cos( radians( lat ) )
* cos( radians( lng ) - radians(-122) ) + sin( radians(37) ) * sin(radians(lat)) ) ) AS distance
FROM markers
HAVING distance < 25
ORDER BY distance
LIMIT 0 , 20;
@jquery404
jquery404 / POST.js
Last active July 5, 2018 10:58
Angular HTTP Post
$http({
method: 'POST',
url: 'ws/ws_assignment_post.php',
data: $.param(reqdata),
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
}).then(function (response) {
var data = response.data;
if (data.status === 0) {
window.location.href = "/assignments.php";
}
<select
class="form-control"
ng-options="sub.employee_id as [sub.employee_name_first,sub.employee_name_last].join(' ') for sub in selectedSubject.teacher"
ng-model="selectedTeacher">
</select>
@jquery404
jquery404 / Time Loop.js
Last active May 16, 2018 03:42
Loop from start time to end time and returns array of times [8:00AM, 8:30AM, 9:00AM, .....]
$scope.selectedInterval = 30;
$scope.updateTimeInterval = function()
{
var startTime = 8;
var endTime = 13;
var tt = startTime*60; // start at 8am
var ap = ['AM', 'PM'];
//loop to increment the time and push results in array
public function uploadFile()
{
$qfilesCount = count($_FILES['quesFiles']['name']);
$afilesCount = count($_FILES['ansFiles']['name']);
$quesImg = array();
$ansImg = array();
for($i = 0; $i < $qfilesCount; $i++)
{
if(!empty($_FILES['quesFiles']['name'][$i]))
@jquery404
jquery404 / 0_reuse_code.js
Created August 29, 2014 21:23
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console