This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
import random | |
import time | |
import platform | |
snowflakes = {} | |
try: | |
# Windows Support |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def baseToBase(originalNumber, originalBase, newBase): | |
originalNumber = str(originalNumber) | |
numberAsInteger = 0 | |
for n in range(0, len(originalNumber)): | |
numberAsInteger = (numberAsInteger * len(originalBase)) + int(originalBase[originalBase.find(originalNumber[n])]) | |
newNumber = "" | |
if (numberAsInteger == 0): newNumber = "0" | |
else: | |
while (numberAsInteger > 0): | |
newNumber = newBase[int(numberAsInteger % len(newBase))] + newNumber |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>MaxifyJS 0.1</title> | |
<style> | |
textarea | |
{ | |
height:600px; | |
max-height:600px; | |
width:49%; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public int numberOfSyllables (String word) | |
{ | |
int syllabeleCount = 0; | |
bool lastWasVowel = false; | |
string lowerCase = word.ToLower ().Replace ("ome", "um").Replace ("ime", "im").Replace ("imn", "imen").Replace ("ine", "in").Replace ("ely", "ly").Replace("ure", "ur").Replace("ery", "ry"); | |
for (int n = 0; n < lowerCase.Length; n++) { | |
if (isVowel (lowerCase [n])) { | |
if (!lastWasVowel) | |
syllabeleCount++; | |
lastWasVowel = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib2 | |
from HTMLParser import HTMLParser | |
class MyHTMLParser(HTMLParser): | |
entered_status_table = False | |
in_table_cell_tag = False | |
status_online = False | |
services_online = {} | |
def get_class(self, attrs): | |
v = "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+(float)systemVersion | |
{ | |
NSArray * versionCompatibility = [[UIDevice currentDevice].systemVersion componentsSeparatedByString:@"."]; | |
float total = 0; | |
int pot = 0; | |
for (NSNumber * number in versionCompatibility) | |
{ | |
total += number.intValue * powf(10, pot); | |
pot--; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)enumerateCharacters:(EnumerationBlock)enumerationBlock | |
{ | |
const unichar * chars = CFStringGetCharactersPtr((__bridge CFStringRef)self); | |
//Function will return NULL if internal storage of string doesn't allow for easy iteration | |
if (chars != NULL) | |
{ | |
NSUInteger index = 0; | |
while (*chars) { | |
enumerationBlock(*chars, index); | |
chars++; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ (void)registerFonts { | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
NSArray * paths = [[NSBundle mainBundle] pathsForResourcesOfType:@"ttf" inDirectory:@""]; | |
for (NSString * path in paths) { | |
NSURL * url = [NSURL fileURLWithPath:path]; | |
CFErrorRef error; | |
CTFontManagerRegisterFontsForURL((__bridge CFURLRef)url, kCTFontManagerScopeNone, &error); | |
error = nil; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Using with an image view | |
imageView.image = [UIImage imageNamed:@"myimage"]; | |
//Using as the background to another view | |
//Note that you will need to redraw the background when resizing | |
//Therefore if you need to animate resizes it may be more sensible to add a UIImageView | |
//as the background to your view | |
UIImage * myImage = [UIImage imageNamed:@"myimage"]; | |
UIGraphicsBeginImageContextWithOptions(myView.bounds.size, NO, 0); | |
[myImage drawInRect:myView.bounds]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def copyright(fname, year, programmer) | |
return "// #{fname} | |
// | |
// Copyright #{year} #{programmer} | |
// | |
// Licensed under the Apache License, Version 2.0 (the \"License\"); | |
// you may not use this file except in compliance with the License. | |
// You may obtain a copy of the License at | |
// | |
// http://www.apache.org/licenses/LICENSE-2.0 |
OlderNewer