Skip to content

Instantly share code, notes, and snippets.

View halfnibble's full-sized avatar
🎃
Coding

Josh Wedekind halfnibble

🎃
Coding
View GitHub Profile
@halfnibble
halfnibble / main.c
Created November 8, 2013 07:54
Test out Gist
#include <stdio.h>
int main(void)
{
printf("Hello World\n");
return 0;
}
# Reusable temperature conversion function
def convert_temperature(to_scale, temperature):
if to_scale == "f" or to_scale == "F":
# Convert to Fahrenheit
return temperature * 9.0 / 5 + 32
elif to_scale == "c" or to_scale == "C":
# Convert to Celsius
return (temperature - 32) * 5.0 / 9.0
else:
@halfnibble
halfnibble / install.sh
Last active August 29, 2015 14:22
Install script for my hosted zip archive of compiled playbook-dev-tools
#!/bin/sh
export NATIVE_TOOLS="/accounts/1000/shared/documents/clitools"
export NATIVE_TOOLS_URL="http://halfnibble.com/bbdev/"
# Write the QNX_CONFIGURATION file
CONFFILE="etc/qnxconf/qconfig/qnx_blackberry_native_development_kit_2.1.0.xml"
@halfnibble
halfnibble / python_example_1.py
Last active August 29, 2015 14:23
Python Example
# Imports
import os
from decimal import Decimal
# Variables
my_name = 'Joshua D. Wedekind'
my_rate = Decimal('120.00')
current_dir = os.getcwd()
# Classes
@halfnibble
halfnibble / test_fails.sh
Created August 6, 2015 08:19
The output of my djagno-cleanerversion tests.
Creating test database for alias 'default'...
Got an error creating the test database: (1007, "Can't create database 'test_pna_demo'; database exists")
Type 'yes' if you would like to try deleting the test database 'test_pna_demo', or 'no' to cancel: yes
Destroying old test database 'default'...
s..........F......F..........F...F.........FFF.Fss..sF.F...FFF.FFF...FsFFF.FF....ss..FF....FF....F.FFFFFF..F..ss
======================================================================
FAIL: test_on_delete (versions_tests.tests.test_models.DeletionHandlerTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/joshua/.envs/pna/local/lib/python2.7/site-packages/versions_tests/tests/test_models.py", line 244, in test_on_delete
@halfnibble
halfnibble / template_example.html
Created January 28, 2016 20:29
HTML template example for Django CMS
<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">
.wrapper {
width: 900px;
margin: 0 auto;
}
.left-bar {
@halfnibble
halfnibble / loadModule.js
Created July 28, 2016 07:35
In case you want to include a function or variable eliminated by Rollup.js treeshaking.
export var loadModule = function(module) {
// Trick Rollup.js to keep JavaScript.
let obj = {
method: function() {}
};
obj.method(module);
};
/* Example usage
@halfnibble
halfnibble / cleandump.py
Created August 30, 2016 05:27
Django Management Command to Create Clean Fixtures
# Place in /installed_app/management/commands/cleandump.py
import os
from django.core import management
from django.core.management.base import BaseCommand, CommandError
class Command(BaseCommand):
help = 'Creates clean dumpdata fixtures.'
@halfnibble
halfnibble / gist:bb24c8d3efa51266d3263a77ca20c523
Last active January 26, 2018 00:25
Apache 2.4 compression settings for virtual host
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/x-javascript application/javascript application/ecmascript
AddOutputFilterByType DEFLATE text/html text/plain text/xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/xml
</IfModule>
@halfnibble
halfnibble / gist:aa21419dbc54ca698f88d1011835673a
Created July 16, 2018 22:58
Secret decoding in JavaScript
// Caesar cipher +2
var encoded_caesar = "vjg"tckp"kp"urckp"hcnnu"ockpn{"qp"vjg"rnckp";
// Divisible by 2: +1, Divisible by 3: +3, Divisible by both: -1
var fancy_cipher = "shf#ne`njqh nf!ojfd jv!41";