Skip to content

Instantly share code, notes, and snippets.

!function() {
var doc = document,
htm = doc.documentElement,
lct = null, // last click target
nearest = function(elm, tag) {
while (elm && elm.nodeName != tag) {
elm = elm.parentNode;
}
return elm;
};
@zspine
zspine / nationalities.php
Last active October 24, 2023 08:58
PHP Nationalities Array
$nationals = array(
'Afghan',
'Albanian',
'Algerian',
'American',
'Andorran',
'Angolan',
'Antiguans',
'Argentinean',
'Armenian',
@tjamps
tjamps / README.md
Last active February 29, 2024 14:57
Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

The API we are creating in this gist will follow these rules :

  • The API only returns JSON responses
  • All API routes require authentication
  • Authentication is handled via OAuth2 with password Grant Type only (no need for Authorization pages and such).
  • API versioning is managed via a subdomain (e.g. v1.api.example.com)

The API will be written in PHP with the Symfony 2 framework. The following SF2 bundles are used :

@Olousouzian
Olousouzian / symfony-tail-dev-color.sh
Created May 9, 2016 15:11
Symfony tail -f color synthax.
tail -f app/logs/dev.log | awk '
/(request|app)\.INFO/ {print "\033[36m" $0 "\033[39m"}
/(request|app)\.WARNING/ {print "\033[33m" $0 "\033[39m"}
/(request|app)\.ERROR/ {print "\033[31m" $0 "\033[39m"}
/(request|app)\.CRITICAL/ {print "\033[31m" $0 "\033[39m"}
'
@OJ7
OJ7 / salat_times.py
Last active September 14, 2021 17:56
Home Assistant Islamic Prayer Times
import json
from datetime import datetime, timedelta
try:
from urllib.request import Request, urlopen # Python 3
except ImportError:
from urllib2 import Request, urlopen # Python 2
def convertTime(salatTime, offset):
salatTime = datetime.strptime(salatTime, '%I:%M %p')
@adilsoncarvalho
adilsoncarvalho / docker-compose.yml
Created September 13, 2018 16:58
Example of a docker-compose.yml mounting cloud_sql_proxy as a service
version: '3'
services:
app:
build: .
# your own configurations for that app
depends_on:
- cloud-sql-proxy
environment:
# You must set an URL to access your database. On sequelize (nodejs) it follows this
@shaneapen
shaneapen / WAXP.js
Last active November 14, 2024 20:45
WhatsApp Group Contacts Exporter
WAXP = (function(){
MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
var SCROLL_INTERVAL = 600,
SCROLL_INCREMENT = 450,
AUTO_SCROLL = true,
NAME_PREFIX = '',
UNKNOWN_CONTACTS_ONLY = false,
MEMBERS_QUEUE = {},