Skip to content

Instantly share code, notes, and snippets.

View ldonjibson's full-sized avatar
💭
I may be slow to respond.

Olayanju A. Ajibola ldonjibson

💭
I may be slow to respond.
View GitHub Profile
@ldonjibson
ldonjibson / css-selectors.md
Created July 30, 2019 06:25 — forked from magicznyleszek/css-selectors.md
CSS Selectors Cheatsheet

CSS Selectors Cheatsheet

Element selectors

Element -- selects all h2 elements on the page

h2 {
    foo: bar;
@ldonjibson
ldonjibson / ISO3166-1.alpha2.json
Created September 17, 2019 20:04 — forked from ssskip/ISO3166-1.alpha2.json
json of country codes (ISO 3166-1 alpha-2) and corresponding names
{
"AF": "Afghanistan",
"AX": "Aland Islands",
"AL": "Albania",
"DZ": "Algeria",
"AS": "American Samoa",
"AD": "Andorra",
"AO": "Angola",
"AI": "Anguilla",
"AQ": "Antarctica",
@ldonjibson
ldonjibson / googlebiz.py
Created October 20, 2019 19:27 — forked from johndavidback/googlebiz.py
Google Places for Business scraper
from scrapy.spider import BaseSpider
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.http import FormRequest
from scrapy.selector import HtmlXPathSelector
from tutorial.items import GoogleItem
# This is the class that does work.
class LoginSpider(BaseSpider):
name = 'google-login'
@ldonjibson
ldonjibson / README.md
Created December 31, 2019 12:02 — forked from mau21mau/README.md
Configure Celery + Supervisor With Django
@ldonjibson
ldonjibson / gist:03f0563f6dd01ef452c292d919dcd04b
Created February 28, 2020 06:08 — forked from segebee/gist:7dde9de8e70a207e6e19
Nigeria States and Local Government Areas JSON - codingsavvy.com
[{"state":{"name":"Abia State","id":1,"locals":[{"name":"Aba South","id":1},{"name":"Arochukwu","id":2},{"name":"Bende","id":3},{"name":"Ikwuano","id":4},{"name":"Isiala Ngwa North","id":5},{"name":"Isiala Ngwa South","id":6},{"name":"Isuikwuato","id":7},{"name":"Obi Ngwa","id":8},{"name":"Ohafia","id":9},{"name":"Osisioma","id":10},{"name":"Ugwunagbo","id":11},{"name":"Ukwa East","id":12},{"name":"Ukwa West","id":13},{"name":"Umuahia North","id":14},{"name":"Umuahia South","id":15},{"name":"Umu Nneochi","id":16}]}},{"state":{"name":"Adamawa State","id":2,"locals":[{"name":"Fufure","id":1},{"name":"Ganye","id":2},{"name":"Gayuk","id":3},{"name":"Gombi","id":4},{"name":"Grie","id":5},{"name":"Hong","id":6},{"name":"Jada","id":7},{"name":"Lamurde","id":8},{"name":"Madagali","id":9},{"name":"Maiha","id":10},{"name":"Mayo Belwa","id":11},{"name":"Michika","id":12},{"name":"Mubi North","id":13},{"name":"Mubi South","id":14},{"name":"Numan","id":15},{"name":"Shelleng","id":16},{"name":"Song","id":17},{"name":"Toung
@ldonjibson
ldonjibson / gist:ccf1ae0be38dc5560255b598f477693f
Created April 19, 2020 05:48 — forked from igniteflow/gist:2889573
Displaying HTML in Django admin
from django.utils.safestring import SafeUnicode
"""
When overriding Django admin templates |safe and autoescape off don't work, so do this instead...
"""
# for a foreign key field in the change form, if you want to override the unicode method, use a proxy
class UserProxy(User):
"""
Using a proxy to present the required formatting: username, email, full name

Scrapy Cheatsheet

For test

scrapy shell https://example.com/

Run

scrapy crawl spider_name

Output

scrapy crawl dapps -o data/07-07-dapps.csv
scrapy crawl dapps -t csv -o - >"data/dapp/$DATE-dapp.csv"

@ldonjibson
ldonjibson / django custom signal
Created May 6, 2020 09:26 — forked from venkatesh22/django custom signal
django custom signals creation example
#signals.py
from django.dispatch import Signal
user_login = Signal(providing_args=["request", "user"])
#views.py
from foo import signals
@ldonjibson
ldonjibson / passenger_wsgi.py
Created May 8, 2020 08:42 — forked from janosgyerik/passenger_wsgi.py
passenger_wsgi.py for a django site
projectname = 'bashoneliners'
virtualenv_root = '/path/to/virtualenv/' + projectname
import sys
import os
INTERP = os.path.join(virtualenv_root, 'bin', 'python')
if sys.executable != INTERP:
os.execl(INTERP, INTERP, *sys.argv)
@ldonjibson
ldonjibson / AIRTIME.txt
Last active September 30, 2020 14:13
MOBILENIG API with INTEGRATION VTUBUSINESSPORTAL(VBP)
AIRTIME
Api name:
mobilenigcom
Api url:
https://mobilenig.com/API/airtime?username=****&api_key=****&network=[network_code]&phoneNumber=[phone]&amount=[amt]&trans_id=[ordernumber]
Api url data:
{"data":{"apikey":"[YOUR_API_KEY]", "userid":"[USER_ID]", "network_id":"[network_code]", "amount":"[amt]", "phoneno":"[phone]"}, "headers":{"authorization": "Bearer (API_KEY)"}}