Skip to content

Instantly share code, notes, and snippets.

Avatar

Will Sams WillSams

View GitHub Profile
@WillSams
WillSams / CSharp-Mode.xshd
Created Sep 24, 2012 — forked from marcusholmgren/CSharp-Mode.xshd
VibrantInk inspired syntax highligthing for C# in SharpDevelop
View CSharp-Mode.xshd
<?xml version="1.0" encoding="utf-8"?>
<!--This file was autogenerated by the #Develop highlighting editor.-->
<!--VibrantInk inspired syntax highligthing for C# in #Develop.-->
<SyntaxDefinition name="C#" extensions=".cs">
<Environment>
<Custom name="TypeReference" bold="false" italic="false" color="Pink" />
<Custom name="UnknownEntity" bold="false" italic="false" color="Yellow" />
<Default bold="false" italic="false" color="White" bgcolor="Black" />
<Selection bold="false" italic="false" color="White" bgcolor="#6897BB" />
<VRuler bold="false" italic="false" color="Pink" bgcolor="#E3E3E3" />
@WillSams
WillSams / DapperTest.py
Created Oct 11, 2012
Quick And dirty example of IronPython using Dapper.NET (w/MySql backend and stored procedures)
View DapperTest.py
#DapperTest.py - Quick And dirty example of IronPython using Dapper.NET (w/MySql backend and stored procedures)
import System
import clr
#clr.AddReferenceByPartialName("System.Core")
clr.AddReferenceByPartialName("System.Data")
from System.Collections import IDictionary
from System.Collections.Generic import IDictionary, IList
from System.Data import IDbConnection, IDbCommand, CommandType
@WillSams
WillSams / main.py
Last active Jun 10, 2020
MonoGame w/ IronPython Example
View main.py
import os, clr
clr.AddReferenceToFile("MonoGame.Framework.dll")
clr.AddReferenceToFile("OpenTK.dll")
from Microsoft.Xna.Framework import *
from Microsoft.Xna.Framework.Graphics import *
class App(Game):
def __init__(self):
self.graphics = GraphicsDeviceManager(self)
@WillSams
WillSams / ConfigProxy.cs
Created Oct 17, 2012
Configuration Helper file to use with Iron Python apps. Just compile it from the command-line.
View ConfigProxy.cs
//ConfigProxy.cs
// Taken modified:
// http://tomestephens.com/2011/02/making-ironpython-work-overriding-the-configurationmanager/
// http://tomestephens.com/2011/02/extending-my-ironpython-toolset/
// command line compile: csc /target:library /out:ConfigProxy.dll ConfigProxy.cs
// In IronPython, to load up your config file:
// import clr
// clr.AddReference('System.Core')
// clr.AddReference('System.Xml')
// clr.AddReference('System.Configuration')
@WillSams
WillSams / Notepad2.ini
Last active Oct 11, 2015
My Notepad2 settings
View Notepad2.ini
[Notepad2]
;Notepad2.ini=%WINDIR%\Notepad2-%USERNAME%.ini
;Notepad2.ini=%APPDATA%\Notepad2.ini
[Settings]
SaveSettings=1
SaveRecentFiles=0
SaveFindReplace=0
CloseFind=0
CloseReplace=0
NoFindWrap=0
@WillSams
WillSams / gist:3933697
Created Oct 22, 2012 — forked from defnull/gist:1224387
Deploy a Bottle app on Heroku
View gist:3933697
mkdir heroku
cd heroku/
virtualenv --no-site-packages env
source env/bin/activate
pip install bottle gevent
pip freeze > requirements.txt
cat >app.py <<EOF
import bottle
import os
View webapplib.py
import logging
import time
logger = logging.getLogger(__name__)
def useful():
logger.debug('Hello from webapplib!')
time.sleep(0.01)
@WillSams
WillSams / gist:4945386
Last active Dec 13, 2015
Custom validators for use with jquery validate
View gist:4945386
jQuery.validator.addMethod("dateGreaterThan", function (value, element, params) {
if (!/Invalid|NaN/.test(new Date(value))) {
return new Date(value) > new Date($(params).val());
}
return isNaN(value) && isNaN($(params).val())
|| (Number(value) > Number($(params).val()));
}, '<br />Must be greater than {0}.');
jQuery.validator.addMethod('greaterThan', function (value, element, param) {
View ubuntu-server-django-guide.rst

Ubuntu Server Setup Guide for Django Websites

This guide is a walk-through on how to setup Ubuntu Server for hosting Django websites. The Django stack that will be used in this guide is Ubuntu, Nginx, Gunicorn and Postgres. I needed an example site for this guide you can use Django Base Site which is available on Github. For more useful information on Ubuntu server installs, please see the documentation here: https://help.ubuntu.com/12.10/serverguide/

@WillSams
WillSams / ubuntu-postgres.sh
Last active Sep 28, 2020
Getting Postgres up & running
View ubuntu-postgres.sh
!#/bin/sh
sudo bash -c "apt update && apt upgrade -y"
sudo bash -c "apt install curl ca-certificates gnupg"
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
. /etc/*release; OS=$ID
if [ "$OS" == 'ubuntu' ]; then
You can’t perform that action at this time.