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 | |
| # This function prints the difference between two python datetime objects | |
| # in a more human readable form | |
| # | |
| # Adapted from: http://www.chimeric.de/blog/2008/0711_smart_dates_in_python | |
| def humanize_date_difference(now, otherdate=None, offset=None): | |
| if otherdate: | |
| dt = otherdate - now | |
| offset = dt.seconds + (dt.days * 60*60*24) |
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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> | |
| <title>Stripe Getting Started Form</title> | |
| <script type="text/javascript" src="https://js.stripe.com/v1/"></script> | |
| <!-- jQuery is used only for this example; it isn't required to use Stripe --> | |
| <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> | |
| <script type="text/javascript"> | |
| // this identifies your website in the createToken call below |
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
| var application_root = __dirname, | |
| express = require("express"), | |
| path = require("path"), | |
| mongoose = require('mongoose'); | |
| var app = express.createServer(); | |
| // database | |
| mongoose.connect('mongodb://localhost/ecomm_database'); |
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
| <style> | |
| #videogroup { | |
| width: 100%; | |
| } | |
| iframe { | |
| width: 90%; | |
| padding: 5%; | |
| } |
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
| #include "Wire.h" | |
| #define DS1307_ADDRESS 0x68 | |
| void setup(){ | |
| Wire.begin(); | |
| Serial.begin(9600); | |
| setDateTime(); //MUST CONFIGURE IN FUNCTION | |
| } | |
| void loop(){ |
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
| #include "Wire.h" | |
| #define DS1307_ADDRESS 0x68 | |
| int alarmPin = 12; | |
| void setup(){ | |
| Wire.begin(); | |
| Serial.begin(9600); | |
| pinMode(alarmPin, OUTPUT); //alarmPin | |
| } |
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
| #include "Wire.h" | |
| #define DS1307_I2C_ADDRESS 0x68 | |
| #include <LiquidCrystal.h> | |
| #include <LCDKeypad.h> | |
| LCDKeypad lcd; | |
| // Convert normal decimal numbers to binary coded decimal | |
| byte decToBcd(byte val) | |
| { |
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
| static NSString* getAddress() { | |
| id myhost =[NSClassFromString(@"NSHost") performSelector:@selector(currentHost)]; | |
| if (myhost) { | |
| for (NSString* address in [myhost performSelector:@selector(addresses)]) { | |
| if ([address rangeOfString:@"::"].location == NSNotFound) { | |
| return address; | |
| } | |
| } | |
| } | |
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
| - (UIImage *)compressImage:(UIImage *)image{ | |
| float actualHeight = image.size.height; | |
| float actualWidth = image.size.width; | |
| float maxHeight = 600.0; | |
| float maxWidth = 800.0; | |
| float imgRatio = actualWidth/actualHeight; | |
| float maxRatio = maxWidth/maxHeight; | |
| float compressionQuality = 0.5;//50 percent compression | |
| if (actualHeight > maxHeight || actualWidth > maxWidth) { |
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
| /* | |
| A set of custom made large numbers for a 16x2 LCD using the | |
| LiquidCrystal librabry. Works with displays compatible with the | |
| Hitachi HD44780 driver. | |
| The Cuicuit: | |
| LCD RS pin to D12 | |
| LCD Enable pin to D11 | |
| LCD D4 pin to D5 | |
| LCD D5 pin to D4 |
OlderNewer