Skip to content

Instantly share code, notes, and snippets.

View level09's full-sized avatar
🌴
Always on vacation

Nidal Alhariri level09

🌴
Always on vacation
View GitHub Profile
from math import ceil
class Pagination(object):
def __init__(self, page, per_page, total_count):
self.page = page
self.per_page = per_page
self.total_count = total_count
<!doctype html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="/css/style.css" />
<style>
body { background: #f0f0f0; margin:0; padding:0;}
</style>
</head>
$('#process-btn').on('click', function (e) {
if ($(this).hasClass('disabled') || ($('.dz-complete').length != $('.dz-processing').length)) {
e.preventDefault();
}
else {
e.preventDefault();
//construct array from filenames
var videos = [];
Dropzone.autoDiscover = false;
$("#dz-video").dropzone({
acceptedFiles: 'video/mp4,video/quicktime',
maxFilesize: 1000,
addRemoveLinks: true,
success: function (file, response) {
$(file['previewElement']).data('filename', response);
//console.log('Successfully uploaded: ' + response);
@bp_public.route('/video-upload',methods=['POST'])
@login_required
def video_upload():
file = request.files['file'] if 'file' in request.files else None
if file:
file_name = datetime.strftime(datetime.now(),'%Y%m%d-%H%S') +'-'+ secure_filename(file.filename)
file.save(os.path.join(Config.UPLOAD_DIR,file_name))
return file_name, 200
37.104.234.112
176.204.166.251
95.185.167.245
176.204.166.187
95.186.126.43
93.169.129.24
78.95.229.134
51.39.164.121
37.241.243.123
188.49.168.89
from extensions import db
from slugify import slugify
class Card(db.Document):
client_id = db.IntField()
card_id = db.SequenceField(unique=True)
ref = db.StringField()
emirate = db.StringField()
@level09
level09 / Bucketfill.py
Last active December 23, 2015 15:11
Kayak Challenge
"""
Bucket Fill Exercise
Imagine you are working on an image editing application. You need to implement a bucket fill tool similar to the one
in paint. The user will use the tool by selecting a color and clicking on the canvas. The tool fills the selected
region of color with the new color.
When a pixel is filled, all of its neighbors (above, below, left, or right) of the same color must also be filled,
as well as their neighbors, and so on, until the entire region has been filled with the new color.
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.2 24320 1048 ? Ss May04 10:53 /sbin/init
root 2 0.0 0.0 0 0 ? S May04 0:00 [kthreadd]
root 3 0.0 0.0 0 0 ? S May04 111:37 [ksoftirqd/0]
root 5 0.0 0.0 0 0 ? S< May04 0:00 [kworker/0:0H]
root 6 0.0 0.0 0 0 ? S May04 0:00 [kworker/u:0]
root 7 0.0 0.0 0 0 ? S< May04 0:00 [kworker/u:0H]
root 8 0.0 0.0 0 0 ? S May04 0:00 [migration/0]
root 9 0.0 0.0 0 0 ? S May04 0:00 [rcu_bh]
root 10 0.0 0.0 0 0 ? S May04 107:26 [rcu_sched]
{
"loc": "",
"youliked": false,
"title": "",
"deleted": false,
"text": "Nature",
"created_at": "2015-08-02 20:28:42",
"views": 0,
"media_thumb": "https://hostname/static/files/videos/2015/08/02/wToYREIrwhtnDdZtpgVQVRJjhIKvje.jpg",
"order": 101,