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
find . -exec touch {} \; |
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
/* | |
* Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: | |
* 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... | |
* By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms. | |
*/ | |
#include <stdio.h> | |
int previousSteps[] = {1,2}; | |
int total = 2; |
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
#include <stdio.h> | |
int main(){ | |
int i; | |
int total; | |
for(i = 0; i<1000; i++) total+=(i%3==0 || i%5==0) ? i : 0; | |
printf("%i", total); | |
printf("\n"); | |
return 0; | |
} |
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
// PHP FizBuzz Solution | |
// Trying to get lowest bytecount. | |
// P.S. Yes, I know it's in PHP yadda-yadda-yadda | |
for($i=1;$i<=100;$i++)print((($i%15==0)?'FizzBuzz':(($i%5==0)?'Buzz':(($i%3==0)?'Fizz':$i)))."\n"); |
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
NSArray* dayArray = [NSArray arrayWithObjects:@"Image One",@"Image Two",@"Image Three",nil]; | |
for(NSString* day in dayArray) | |
{ | |
for(int i=1;i<=2;i++) | |
{ | |
UIImage* image = [UIImage imageNamed:[NSString stringWithFormat:@"%@%d.png",day,i]]; | |
unsigned char* pixels = [image rgbaPixels]; | |
double totalLuminance = 0.0; | |
for(int p=0;p<image.size.width*image.size.height*4;p+=4) | |
{ |
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
<?php | |
// Change the following: | |
// TABLE_NAME = the name of your table | |
// COLUMN_NAME = the name of your column with an enum type | |
$result = mysql_query("SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'TABLE_NAME' AND COLUMN_NAME = 'COLUMN_NAME'"); | |
if(mysql_num_rows($result) == 1){ | |
$remove = array('enum(', ')', "'"); | |
$row = mysql_fetch_assoc($result); | |
$array = explode(',', str_replace($remove, '', $row['COLUMN_TYPE'])); |
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
SELECT widget_id, ((positive + 1.9208) / (positive + negative) - 1.96 * SQRT((positive * negative) / (positive + negative) + 0.9604) / (positive + negative)) / (1 + 3.8416 / (positive + negative)) AS ci_lower_bound FROM widgets ORDER BY ci_lower_bound DESC; |
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
UILongPressGestureRecognizer *lpgr = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)]; | |
lpgr.minimumPressDuration = 1.0; | |
[self.mapView addGestureRecognizer:lpgr]; | |
// --------------------------------- | |
- (void)handleLongPress:(UIGestureRecognizer *)gestureRecognizer{ | |
if (gestureRecognizer.state != UIGestureRecognizerStateBegan)return; | |
CGPoint touchPoint = [gestureRecognizer locationInView:self.mapView]; | |
CLLocationCoordinate2D touchCoordinate = |
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
RewriteEngine On | |
RewriteBase / | |
RewriteCond %{REMOTE_HOST} !^00\.00\.00\.00 # Put your IP here | |
RewriteRule .* http://www.google.com [R=302,L] |
NewerOlder