This file contains hidden or 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
| <?php | |
| /** | |
| * Send email | |
| * @param string|array $email | |
| * @param object $from | |
| * @param string $subject | |
| * @param string $message | |
| * @param string $headers optional | |
| */ | |
| function send_email($email, $from, $subject, $message, $headers = null) |
This file contains hidden or 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 | |
| """Simple HTTP Server With Upload. | |
| This module builds on BaseHTTPServer by implementing the standard GET | |
| and HEAD requests in a fairly straightforward manner. | |
| """ |
This file contains hidden or 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
| <? | |
| /* | |
| # This program is free software; you can redistribute it and/or | |
| # modify it under the terms of the GNU General Public License | |
| # as published by the Free Software Foundation; either version 2 | |
| # of the License, or (at your option) any later version. | |
| # | |
| # This program is distributed in the hope that it will be useful, | |
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
This file contains hidden or 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 "NSDate+DateExtensions.h" | |
| @implementation NSDate (DateExtensions) | |
| + (NSDate *) currentDateInSystemTimezone | |
| { | |
| NSDate* sourceDate = [NSDate date]; | |
| NSTimeZone* sourceTimeZone = [NSTimeZone timeZoneWithAbbreviation:@"GMT"]; | |
| NSTimeZone* destinationTimeZone = [NSTimeZone systemTimeZone]; |
This file contains hidden or 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
| <?php | |
| /* | |
| Note 1: All variables are unsigned 32 bits and wrap modulo 232 when calculating, except | |
| ml the message length which is 64 bits, and | |
| hh the message digest which is 160 bits. | |
| Note 2: All constants in this pseudo code are in big endian. | |
| Within each word, the most significant byte is stored in the leftmost byte position | |
| */ |
This file contains hidden or 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
| The only requirements for popup footnotes in iBooks are: | |
| * Ebook has to be an EPUB3 | |
| * epub:type "noteref" and "footnote" | |
| So you can link to a totally separate document, as you normally would for endnotes, | |
| but include the attributes so the <a> link behaves differently in iBooks, instead triggering the popup. | |
| Original reference link would look something like this (in a file called ch001.html): | |
| <a epub:type="noteref" href="footnote.html#note1">1</a></div> |
This file contains hidden or 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
| // removes all but first occurrence from a sequence, returning an array. | |
| // requires elements to be hashable, not just equatable, but the alternative | |
| // of using contains is very inefficient | |
| // alternatively, could require comparable, sort, and remove adjacent dupes | |
| func uniq<S: SequenceType, E: Hashable where E==S.Generator.Element>(seq: S) -> [E] { | |
| var seen: [S.Generator.Element:Int] = [:] | |
| return filter(seq) { !seen.updateValue(1, forKey: $0).hasValue } | |
| } | |
| // TODO: a version that takes a custom comparator function, say for lexicographic deduping |
This file contains hidden or 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
| // | |
| // IntExtension.swift | |
| // CryptoSwift | |
| // | |
| // Created by Marcin Krzyzanowski on 12/08/14. | |
| // Copyright (C) 2014 Marcin Krzyżanowski <marcin.krzyzanowski@gmail.com> | |
| // This software is provided 'as-is', without any express or implied warranty. | |
| // | |
| // In no event will the authors be held liable for any damages arising from the use of this software. | |
| // |
This file contains hidden or 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
| // | |
| // Version 3 of pagesFromData from Functional Wish Fulfillment | |
| // http://robnapier.net/functional-wish-fulfillment | |
| // | |
| import Foundation | |
| func pagesFromData(data: NSData) -> Result<[Page]> { | |
| return continueWith(asJSON(data)) { | |
| continueWith(asJSONArray($0)) { |
This file contains hidden or 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
| // The MIT License (MIT) | |
| // | |
| // Copyright (c) 2014 Nate Cook | |
| // | |
| // Permission is hereby granted, free of charge, to any person obtaining a copy | |
| // of this software and associated documentation files (the "Software"), to deal | |
| // in the Software without restriction, including without limitation the rights | |
| // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| // copies of the Software, and to permit persons to whom the Software is | |
| // furnished to do so, subject to the following conditions: |
OlderNewer