Skip to content

Instantly share code, notes, and snippets.

View royletron's full-sized avatar
🛴
scootin'

Darren royletron

🛴
scootin'
View GitHub Profile
@royletron
royletron / arrays total.py
Last active December 15, 2015 00:58
Arrays total
from array import *
a = array('i', [20, 18, 23, 43])
b = 0
for i in a:
b += i
print(b)
from array import *
a = array('i', [20, 15, 5])
b = 0
for i in a:
if i > b:
b = i
print(b)
from array import *
a = ["Orange", "Apple", "Banana", "Grapefruit", "Pear"]
b = ""
for i in a:
if len(i) > len(b):
b = i
print(b)
a = ["red", "blue", "red", "red", "yellow"]
b = 0
for i in a:
if i == "red":
b += 1
print(b)
a = [2, 17, 24, 6, 7, 29, 11, 10]
b = []
for i in a:
if i > 10:
b.append(i)
print(b)
number = 10
non_number = "11"
print(number)
print(non_number)
total = number + int(non_number)
print(total)
class Sheep:
name=""
species=""
legs=0
sheep = Sheep()
sheep.name = "Brian"
sheep.species = "Sheep"
sheep.legs = 4
@royletron
royletron / gist:6883179
Created October 8, 2013 11:17
Get IE10 on OSX through VirtualBox
curl -s https://raw.github.com/xdissent/ievms/master/ievms.sh | IEVMS_VERSIONS="10" bash
@royletron
royletron / markdown.js
Created November 5, 2013 11:00
A CodeMirror markdown type that will allow for different header types as follows: # Header 1 = .cm-header1 ## Header 2 = .cm-header2 ### Header 3 = .cm-header3
CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
var htmlFound = CodeMirror.modes.hasOwnProperty("xml");
var htmlMode = CodeMirror.getMode(cmCfg, htmlFound ? {name: "xml", htmlMode: true} : "text/plain");
var aliases = {
html: "htmlmixed",
js: "javascript",
json: "application/json",
c: "text/x-csrc",
"c++": "text/x-c++src",
<script>
// Include the UserVoice JavaScript SDK (only needed once on a page)
UserVoice=window.UserVoice||[];(function(){var uv=document.createElement('script');uv.type='text/javascript';uv.async=true;uv.src='//widget.uservoice.com/7CG8E4U5kiudcVZQO1KgOg.js';var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(uv,s)})();
//
// UserVoice Javascript SDK developer documentation:
// https://www.uservoice.com/o/javascript-sdk
//
// Set colors