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
@level09
level09 / index.html
Created February 15, 2021 12:02
rgbKineticSlider - Demo 2
<body class="demo-1 loading">
<main>
<div class="message">Some message for mobile (if needed).</div>
<div class="frame">
<div class="frame__title-wrap">
<h1 class="frame__title">rgbKineticSlider</h1>
<p class="frame__tagline">Demo 2</a></p>
</div>
<div class="frame__links">
<a href="https://github.com/hmongouachon/rgbKineticSlider">View this project on GitHub</a>
# -------------------------------- using numpy
from __future__ import print_function
import math
import numpy as np
from numpy import trapz
@level09
level09 / gist:b2970326a33d88c27ef24bf6bb803bc1
Created October 1, 2018 18:14 — forked from Sinkler/gist:bfc2099235ac96937f34
Flask-OAuthlib sample config: twitter, facebook, instagram, vk
# Twitter
from app.config import TWITTER_APP_KEY, TWITTER_APP_SECRET
twitter_oauth = oauth.remote_app(
'twitter',
consumer_key=TWITTER_APP_KEY,
consumer_secret=TWITTER_APP_SECRET,
base_url='https://api.twitter.com/1.1/',
request_token_url='https://api.twitter.com/oauth/request_token',
@level09
level09 / canvas-fill
Created April 18, 2018 12:19
Fill image into canvas while maintaining aspect ratio
function drawImageProp(ctx, img, x, y, w, h, offsetX, offsetY) {
if (arguments.length === 2) {
x = y = 0;
w = ctx.canvas.width;
h = ctx.canvas.height;
}
// default offset is center
offsetX = typeof offsetX === "number" ? offsetX : 0.5;
@level09
level09 / ecommerce.html
Created June 13, 2016 18:21
Ecommerce Tracking Code
<script>
ga('require', 'ecommerce');
ga('ecommerce:addTransaction', {
'id': '[Transaction ID]', // Transaction ID. Required.
'affiliation': 'DUKES Hotel', // Affiliation or store name.
'revenue': '[11.99]', // Grand Total.
'shipping': '0', // Shipping.
'tax': '[1.29]' // Tax.
@level09
level09 / 0_reuse_code.js
Created March 12, 2016 11:32
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
{% macro render_pagination(pagination) %}
<nav class="pagination">
{% if pagination.has_prev %}
<a class="prev" href="{{ url_for_other_page(pagination.page -1)}}">
< Previous
</a>
{% endif %}
{%- for page in pagination.iter_pages() %}
PER_PAGE = 30
def records_for_page(page=1):
results = Property.objects.filter.order_by('-date').skip((page-1)*PER_PAGE).limit(PER_PAGE)
count = Property.objects.filter.order_by('-date').skip((page-1)*PER_PAGE).limit(PER_PAGE).count()
return count, results
@bp_public.route('/',defaults={'page':1},methods=['GET'])
@bp_public.route('/page/<int:page>')
PER_PAGE = 30
def records_for_page(page=1):
return Property.objects.filter.order_by('-date').skip((page-1)*PER_PAGE).limit(PER_PAGE)