Skip to content

Instantly share code, notes, and snippets.

View leenattress's full-sized avatar
🎯
Generally Smashing It

Lee Nattress leenattress

🎯
Generally Smashing It
View GitHub Profile
@leenattress
leenattress / gist:4996919
Created February 20, 2013 16:39
mysql tables backup
<?php
/* backup the db OR just a table */
function backup_tables($bu_dir,$host,$user,$pass,$name,$tables = '*')
{
$link = mysql_connect($host,$user,$pass);
mysql_select_db($name,$link);
//get all of the tables
if($tables == '*')
@leenattress
leenattress / facebook_edge
Last active December 20, 2015 09:59
Facebook edge event
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
// init the FB JS SDK
FB.init({
appId : 'YOUR_APP_ID_HERE', // App ID from the app dashboard
channelUrl : 'http://www.YOUR_DOMAIN_THINGY.com/channel.html', // Channel file for x-domain comms
status : true, // Check Facebook Login status
xfbml : true // Look for social plugins on the page
});
@leenattress
leenattress / is_bfpo.html
Created December 20, 2013 14:39
Is this a BFPO? Really kludgey solution, that works.
<html>
<head>
<title>Is this a BFPO?</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
jQuery( document ).ready(function( $ ) {
var is_bfpo = new Array('2', '4', '6', '8', '10', '11', '12', '14', '15', '16', '18', '19', '22', '26', '28', '30', '31', '35', '38', '39', '40', '44', '47', '49', '50', '52', '53', '56', '57', '58', '59', '61', '63', '65', '68', '105', '109', '113', '115', '140', '622', '642', '655', '655', '655', '655', '655', '677', '678', '801', '802', '805', '806', '808', '825', '204', '205', '208', '210', '213', '214', '215', '221', '222', '229', '231', '241', '243', '251', '252', '254', '255', '267', '268', '269', '270', '271', '272', '273', '275', '276', '279', '280', '281', '282', '285', '288', '292', '300', '305', '309', '318', '323', '324', '334', '335', '338', '339', '345', '350', '357', '358', '361', '362', '363', '365', '366', '367', '368', '369', '375', '377', '378', '380', '381', '382', '384', '386', '387', '395', '398', '39
@leenattress
leenattress / tablesizes
Created March 3, 2014 12:19
An sql script to list the table and their sizes in kb
USE YOUR_DB_NAME;
SELECT
t.NAME AS TableName,
s.Name AS SchemaName,
p.rows AS RowCounts,
SUM(a.total_pages) * 8 AS TotalSpaceKB,
SUM(a.used_pages) * 8 AS UsedSpaceKB,
(SUM(a.total_pages) - SUM(a.used_pages)) * 8 AS UnusedSpaceKB
FROM
@leenattress
leenattress / gist:03687a1a28e76d97ad41
Created June 14, 2014 20:51
Android MX box Linux SSH login
Gabriels-MacBook-Pro:~ gabrielcrowe$ ssh 192.168.2.8 -l root
The authenticity of host '192.168.2.8 (192.168.2.8)' can't be established.
RSA key fingerprint is zzzzzzzzzzzzzzzzzzzzzzzzzz.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.2.8' (RSA) to the list of known hosts.
root@192.168.2.8's password:
[root@MX /root]# ls
lost+found/
[root@MX /root]# cd /
[root@MX /]# ls
@leenattress
leenattress / big_mac.xml
Created March 4, 2016 21:31
Sandwich XML First Draft
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!--
The Big Mac consists of two 1.6 oz (45.4 g)
100 per cent beef patties, American cheese,
"special sauce" (a variant of Thousand Island
dressing), iceberg lettuce, pickles, and
onions, served in a three-part sesame
seed bun.
https://upload.wikimedia.org/wikipedia/commons/thumb/9/9a/Big_Mac_hamburger.jpg/230px-Big_Mac_hamburger.jpg
-->
@leenattress
leenattress / BLT.xml
Last active March 4, 2016 21:59
version 2
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!--
BLT - Bacon Lettuce and Tomato, buttered on white bread, red sauce.
Though there are various styles of BTL, I have chosen to place
the tomato sauce so that it is in direct contact with the bacon
and before the lettuce and tomato. Please note that tomato
is a *fruit*.
https://upload.wikimedia.org/wikipedia/commons/thumb/f/f1/BLT_sandwich_%281%29.jpg/800px-BLT_sandwich_%281%29.jpg
-->
<sandwich>
@leenattress
leenattress / proc.lua
Created April 18, 2017 23:14
Pico8 perlin noise example with infinite scrolling
pico-8 cartridge // http://www.pico-8.com
version 8
__lua__
-- @gabrielcrowe
-- some perlin noise and a scrolly desert
function _init()
local f={}
local p={}
local permutation={151,160,137,91,90,15,
131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,
@leenattress
leenattress / pico8_vector_test.lua
Last active September 15, 2017 22:57 — forked from anonymous/pico8_vector_test.lua
pico8_vector_test
function _init()
hexchar="0123456789abcdef"
function hex(x)
x=flr(x)+1
return sub(hexchar,x,x)
end
charhex={}
for i=1,16 do
function _init()
hexchar="0123456789abcdef"
function hex(x)
x=flr(x)+1
return sub(hexchar,x,x)
end
charhex={}
for i=1,16 do