Skip to content

Instantly share code, notes, and snippets.

View PaulSebalu's full-sized avatar
🎯

Paul Sebalu PaulSebalu

🎯
  • Kampala
  • 12:27 (UTC +03:00)
View GitHub Profile
window.onload = function() {
console.log('window.onload event fired');
// Find the button by data-pp-command attribute
var button = document.querySelector('[data-pp-command="instructForm"]');
// Check if the button is found
if (button) {
// Modify the button label
button.innerText = 'Instruct'; // Replace 'New Button Label' with your desired label
[data-view="newMatterForm"] .intake-form-template-2 .matter-type-icon,
[data-view="newMatterForm"] .intake-form-template-3 .matter-type-icon {
width: 100px !important;
height: 100px !important;
}
.matter-type-icon .circle-matter-type {
width: 100%;
height: 100%
{"toggle":[{"target":"newMatterSelector","status":0},{"target":"newMatterContent","status":1},{"target":"newMatterLoading","status":0}],"html":"
<div class=\"row\">\n
<div class=\"pp-col-xs-24\">\n
<h2 class=\"text-center\">THANK YOU!<\/h2>\n
<p class=\"text-center\">Thank you for your information.<br \/>
A member of our team will be in touch shortly.<\/p>\n <\/div>\n<\/div>\n
<div class=\"gap15\"><\/div>","scroll":0,"update":{"postcode":""}}
{"html":"
<h3>Your Estimate<\/h3>\n
<div class=\"pp-quote-container\">\n
<div class=\"row\">\n
<div class=\"pp-col-xs-24 pp-col-sm-24\">\n
<div class=\"row\">\n
<div class=\"pp-col-xs-24 pp-col-sm-12 pp-hidden-xs\">\n
<h4 class=\"margin0\">Your Details<\/h4>\n
<p>We have not saved your details as you did not consent to being contacted.<\/p>\n \n <\/div>\n
<div class=\"pp-col-xs-24 pp-col-sm-12\">\n
//set timeout for network request and show exception
await axios
.post(`${API_URL}/bank/verify`, {
...data,
})
.then((res) => {
setStatus({
status: res.data,
type: 'info',
})
@PaulSebalu
PaulSebalu / getDates.js
Last active November 29, 2022 12:52 — forked from miguelmota/getDates.js
Get times in between two timestamps with JavaScript.
/**
* Made a few tweaks from Miguel's original code to...
* meet my usecase.
*/
import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc';
import customParseFormat from 'dayjs/plugin/customParseFormat';
import timezone from 'dayjs/plugin/timezone';
dayjs.extend(utc);
[
{
"city": "New York",
"growth_from_2000_to_2013": "4.8%",
"latitude": 40.7127837,
"longitude": -74.0059413,
"population": "8405837",
"rank": "1",
"state": "New York"
},
def counter(func):
"""
A decorator that counts and prints the number of times a function has been executed
"""
def wrapper(*args, **kwargs):
wrapper.count = wrapper.count + 1
res = func(*args, **kwargs)
print '{0} has been used: {1}x'.format(func.__name__, wrapper.count)
return res
wrapper.count = 0
# Link to repo: https://github.com/PaulSebalu/bookstore
# using the interactive shell: "python manage.py shell"
from django.db.models import Count
from store.models import Author
authors=Author.objects.annotate(Count('book')).order_by('-book__count')
for author in authors:
f"{author.name}. {author.book__count}"
# Link to repo: https://github.com/PaulSebalu/bookstore
# using the interactive shell: "python manage.py shell"
from django.db.models import Prefetch
from store.models import Author
authors=Author.objects.prefetch_related(Prefetch("book_set")).all()
for author in authors:
f"{author.name}:{author.book_set.all()}"