Skip to content

Instantly share code, notes, and snippets.

View tclancy's full-sized avatar

Tom Clancy tclancy

View GitHub Profile
@vshjxyz
vshjxyz / Tastypie datatables with pagination.coffee
Last active February 28, 2019 06:23
This is a simple example of a working datatable using tastypie. I also Implemented the fnServerData so the datatable can paginate, search (via a query parameter configured in tastypie in the apply_filter method of the OrderResource), and sort columns using custom logics via the order_by parameter of tastypie.
@orders_table = $('#orders-table', element).dataTable
bProcessing: true
bServerSide: true
sAjaxSource: ORDERFULL_API
sAjaxDataProp: "objects"
aoColumns: [
# Put the resource name that corresponds to each table column
{
"mData": "id"
"sClass": "order-id"
@elmarcoh
elmarcoh / table_init.js
Created October 26, 2012 21:35
Using Tastypie as an Ajax Source for DataTables
$('#participantes-table').dataTable({
bProcessing: true,
bServerSIde: true,
sAjaxSource: "/path/to/your/tastypie/api/list/objects/?format=json",
sAjaxDataProp: "objects",
aoColumns: [
// Put the resource name that corresponds to each table column
{'mData': "your"},
{'mData': "columns"},
],
@tony-landis
tony-landis / recurse_image_optimize.sh
Created October 18, 2012 01:36
Recursively Optimize JPGs and PNGs using PNGCRUSH and JPEGTRAN
#!/bin/sh
# script for optimizing images in a directory (recursive)
# pngcrush & jpegtran settings from:
# http://developer.yahoo.com/performance/rules.html#opt_images
# pngcrush
for png in `find . | grep .png`; do
echo "crushing $png ..."
pngcrush -rem alla -reduce -brute "$png" temp.png
@leggomuhgreggo
leggomuhgreggo / grep.text
Last active February 29, 2020 18:34
Command to grep spoofed package names from hacktask npm user
find . -name "package.json" -exec grep -nwE 'babelcli|crossenv|cross-env.js|d3.js|fabric-js|ffmepg|gruntcli|http-proxy.js|jquery.js|mariadb|mongose|mssql.js|nodecaffe|nodefabric|node-fabric|nodeffmpeg|nodemailer-js|nodemailer.js|nodemssql|node-opencv|node-opensl|node-openssl|noderequest|nodesass|nodesqlite|node-sqlite|node-tkinter|opencv.js|openssl.js|proxy.js|shadowsock|smb|sqlite.js|sqliter|sqlserver|tkinter' {} +
@eddieantonio
eddieantonio / fabfile.py
Created September 28, 2013 01:06
Fabric: task to authorize your SSH key on a remote host.
"""
Installs your SSH key on other hosts. A fabfile for lazy people.
"""
from fabric.api import task, run, put, env, cd
# Use sh instead of bash.
env.shell = '/bin/sh -l -c'
@task
@livcarman
livcarman / docker-cleanup.sh
Created October 3, 2018 17:24
Docker Cleanup/Purge
#!/bin/bash
# This cleans out absolutely EVERYTHING, unlike `docker system prune`
# Stop all running containers
docker stop $(docker ps -a -q)
# Delete all containers
docker rm $(docker ps -a -q)
@imkevinxu
imkevinxu / template.html
Created August 16, 2012 02:11
Django code to read uploaded CSV file
<form action="{% url %}" method="post" enctype="multipart/form-data">{% csrf_token %}
<input type="file" name="csv_file" />
<input type="submit" value="Upload" />
</form>
  • Run a project-wide search for 'todo' / 'TODO' / 'to do' / 'TO DO' and make sure they’re resolved
  • Write any and all necessary project documentation (in /_docs/project)
  • realfavicongenerator.net
  • Ensure the following items have good values:
    • Anything/everything in <head> … </head>
    • humanstxt.org
    • (Craft CMS only) Anything/everything generated by SEOmatic
  • Confirm 404 is reached when expected
  • Confirm robots.txt has the desired values
  • Confirm analytics script is in-place when in production
@shettayyy
shettayyy / pre-commit-eslint
Last active December 10, 2021 05:27
Pre-commit hook for Linting JS with ESLint before commit.
#!/bin/sh
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep ".jsx\{0,1\}$")
ESLINT="$(git rev-parse --show-toplevel)/node_modules/.bin/eslint"
if [[ "$STAGED_FILES" = "" ]]; then
exit 0
fi
PASS=true
@NotSqrt
NotSqrt / settings_test_snippet.py
Last active May 1, 2022 01:34 — forked from nealtodd/settings_test_snippet.py
Another shot at this problem ..
class DisableMigrations(object):
def __contains__(self, item):
return True
def __getitem__(self, item):
return "notmigrations"
MIGRATION_MODULES = DisableMigrations()