Skip to content

Instantly share code, notes, and snippets.

Gezim Hoxha hgezim

  • Edmonton, Alberta, Canada
View GitHub Profile
@hgezim
hgezim / debugging_filters_in_wp.php
Created Sep 3, 2018
This function displays the hooks attached on a filter so you can see what's messing you up!
View debugging_filters_in_wp.php
<?php
function viper_debug_filter( $filter ) {
add_filter( $filter, function( $value ) {
global $wp_filter;
$filters = array();
foreach ( (array) $wp_filter[ current_filter() ]->callbacks as $priority => $functions ) {
foreach ( (array) $functions as $function => $args ) {
$filters['Priority ' . $priority][] = $args;
@hgezim
hgezim / download_drip_broadcasts.py
Created Sep 1, 2018
Download Drip Broadcasts for Backup
View download_drip_broadcasts.py
import requests
from requests.auth import HTTPBasicAuth
import os
import json
# TODO: replace DRIP TOKEN, :account_id, BACKUP_DIR
broadcasts = requests.get('https://api.getdrip.com/v2/:account_id/broadcasts',
auth=HTTPBasicAuth('DRIP TOKEN', ''),
headers={
View npm-debug.log
Last login: Thu Nov 12 13:17:48 on ttys013
ssh -p 64771 ubuntu@54.158.55.14Gezims-MacBook-Pro:frontend gezim$ ssh -p 64771 ubuntu@54.158.55.14
The authenticity of host '[54.158.55.14]:64771 ([54.158.55.14]:64771)' can't be established.
ECDSA key fingerprint is SHA256:ZR/CnZW46nEaaJBuNh9mEWZqvjxP9ltuVHwSYLWrL/Y.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[54.158.55.14]:64771' (ECDSA) to the list of known hosts.
Last login: Thu Nov 12 20:28:28 2015 from 10.155.244.26
ubuntu@box440:~$ ps aux | grep jest
ubuntu 12528 0.0 0.0 4440 624 pts/3 S+ 20:29 0:00 sh -c gulp env unsymlink; jest --maxWorkers 4
ubuntu 12539 49.7 0.0 1092680 208932 pts/3 Sl+ 20:29 0:04 node /home/ubuntu/frontend/node_modules/.bin/jest --maxWorkers 4
View models.py
class Post(models.Model):
title = models.CharField(max_length=500)
hn_id = models.CharField(max_length=50, unique=True)
points = models.IntegerField(null=True)
comment_count = models.IntegerField()
comments_link = models.URLField()
date = models.DateTimeField() # datetime that HN post was posted
date_scraped = models.DateTimeField(auto_now_add = True) # date object was scraped from HN
date_modified = models.DateTimeField(auto_now = True) # date this object has been updated (rescraped)
# link the story is linked to -- HN links can be long so set max_length to 2000
@hgezim
hgezim / comment_cwd.py
Last active Dec 12, 2015
Python script that gets every line in every file in the current directory and appends '//' to the front.
View comment_cwd.py
"""Python script that gets every line in every file in the current directory and appends '//' to the front."""
import os
os.listdir('.')
file_names = os.listdir('.')
for file in file_names:
opened_file = open(file)
lines = opened_file.readlines()
for line in lines:
print "// %s" % (line),
View gist:4478170
#!/bin/bash
## LockFile function ##
# example:
# main() {
# LockFile create
# RunScriptStuff
# LockFile remove
# }
#Globals
@hgezim
hgezim / JavaScript Community FAQs.md
Last active Dec 24, 2018
JavaScript Community FAQs
View JavaScript Community FAQs.md

Google+ JavaScript Community FAQs

These are frequently asked question in the JavaScript Community.

  1. How do I do thing in Java?

That's a great question! Please find a Java community on Google+ to ask. JavaScript is not the same as Java. Here's a good explanation of the differences between Java and JavaScript: http://www.dannyg.com/ref/javavsjavascript.html.

View gist:4410072
Meteor.methods
sendListToEmails: (from_email, to_emails, list_id, uid) ->
Meteor.http.post('blah')
blah_blue: () ->
console.log "Sup."
create_user: () ->
console.log "In createuser Meteor method."
View gist:4053581
TeamDoListRouter = Backbone.Router.extend
initialize: (options) ->
# IMPORTANT: These get matched in the reverse order that they show up
@route(/\?*/, "home") #Match / followed by a question mark or 0 question marks
@route(/([a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12})/, "list") # Match a GUID
home: () ->
Session.set('page', 'home')
initHome()
this.navigate ''
View gist:2271780
t = (s, d) ->
s = s.replace new RegExp("{{#{k}}}", 'g'), v for k, v of d
return s
You can’t perform that action at this time.