Skip to content

Instantly share code, notes, and snippets.

View alairock's full-sized avatar

Skyler Lewis alairock

View GitHub Profile
console.log('hello from nav.js');
let triggers;
let hero = $('.hero-color')[0];
const navBkgrnd = $('.nav')[0];
const nav = $('.nav-color');
const navCTA = $('.nav-cta-btn')[0];
const navBurger = $('.bar1, .bar2, .bar3');
const nav1 = $('#nav-logo-v1')[0]; // previously white
const nav2 = $('#nav-logo-v2')[0]; //previously black
$(document).ready(function(){
import asyncio
loop = asyncio.get_event_loop()
loop.run_until_complete(some_func())
@alairock
alairock / finecontrol.py
Last active March 8, 2018 22:10
Asyncio examples
import asyncio
async def meow(number):
print(f'starting {number}')
await asyncio.sleep(1)
print(f'stopping {number}')
async def run():
@alairock
alairock / exceptions.py
Last active October 19, 2025 19:43
Python Async Retry Decorator.
class TooManyTriesException(BaseException):
pass
@alairock
alairock / requirements.txt
Created June 5, 2017 01:51
sirbot boilerplate
git+git://github.com/pyslackers/sir-bot-a-lot.git@master
git+https://github.com/pyslackers/sirbot-slack.git@master
git+https://github.com/pyslackers/sirbot-plugins.git@master
@alairock
alairock / cd.sh
Last active June 1, 2017 23:44
Activate virtual environment (Assumes ./venv/bin/activate as activator)
cd(){
venvactifile=./venv/bin/activate
builtin cd "$@";
if [ -e "$venvactifile" ]; then
source $venvactifile
export PYTHONPATH=$(pwd)
echo "IN LIKE FLYNN"
else
if type deactivate >/dev/null 2>&1
then
@alairock
alairock / lastfm-collage.txt
Created April 18, 2017 15:04
Create a collage with Python Image Library and LastFM's API
import random
from PIL import Image, ImageDraw, ImageFont
import requests
import sys
import urllib
from pprint import pprint
url = "http://ws.audioscrobbler.com/2.0/"
body = {
'method': "user.gettopartists",
import requests
import sys
import urllib
from pprint import pprint
url = "http://ws.audioscrobbler.com/2.0/"
body = {
'method': "user.gettopartists",
'user': "alairock",
'api_key': '301a3a6d4301644d5a078e7f1fac0e78',
@alairock
alairock / phpdockerdebug.sh
Created February 14, 2017 17:08
Docker debug php
#! /bin/bash
HOST_IP=`/sbin/ip route | awk '/default/ { print $3 }'`
sudo apt update
sudo apt install php-xdebug
echo "zend_extension=/usr/lib/php/20131226/xdebug.so" > /etc/php/5.6/fpm/conf.d/20-xdebug.ini
echo "xdebug.remote_handler=dbgp" >> /etc/php/5.6/fpm/conf.d/20-xdebug.ini
echo "xdebug.remote_mode=req" >> /etc/php/5.6/fpm/conf.d/20-xdebug.ini
echo "xdebug.var_display_max_data = 2048" >> /etc/php/5.6/fpm/conf.d/20-xdebug.ini
echo "xdebug.var_display_max_depth = 128" >> /etc/php/5.6/fpm/conf.d/20-xdebug.ini
echo "xdebug.max_nesting_level = 500" >> /etc/php/5.6/fpm/conf.d/20-xdebug.ini
@alairock
alairock / intercommy.py
Created February 3, 2017 18:51
Mass update intercom user_id's and/or emails.
from intercom import Intercom, User, errors
import requests
_APP_ID = "arst234"
_APP_KEY = "arsttsrdhwfpgj3245rdsrsp2453rstd"
_DBNAME = "arst"
_DBUSER = "arst"
_DBHOST = "localhost"
_DBPASS = "arst"