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
from cmd import Cmd | |
class MyCmd(Cmd): | |
def onecmd(self, str): | |
if str == 'ls': | |
# here we should print the files in the cwd | |
print 'No files. Sorry!' | |
def precmd(self, line): |
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
function resize_image($file, $w, $h, $crop=FALSE) { | |
list($width, $height) = getimagesize($file); | |
$r = $width / $height; | |
if ($crop) { | |
if ($width > $height) { | |
$width = ceil($width-($width*abs($r-$w/$h))); | |
} else { | |
$height = ceil($height-($height*abs($r-$w/$h))); | |
} | |
$newwidth = $w; |
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
<script> | |
$("#my_upload_form").bind("submit", function() { | |
var ext = $('#my_file_field').val().split('.').pop().toLowerCase(); | |
if($.inArray(ext, ['gif','png','jpg','jpeg']) == -1) { | |
alert('invalid extension!'); | |
} | |
}); | |
</script> |
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
2015-02-28 04:30:32.863 InRadar[8673:613] Unable to simultaneously satisfy constraints. | |
Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) | |
( | |
"<NSLayoutConstraint:0x7fca2a51ee10 H:[UIButton:0x7fca2a51fa50(63)]>", | |
"<NSLayoutConstraint:0x7fca2a531550 H:[UIView:0x7fca2a531370(1)]>", | |
"<NSLayoutConstraint:0x7fca2a520e40 H:[UIButton:0x7fca2a520c70(140)]>", | |
"<NSLayoutConstraint:0x7fca2a531ab0 H:[UIView:0x7fca2a5319d0(1)]>", | |
"<NSLayoutConstraint:0x7fca2a5212a0 H:[UIButton:0x7fca2a521080(75)]>", | |
"<NSLayoutConstraint:0x7fca2a532120 H:|-(8)-[UIButton:0x7fca2a51fa50] (Names: '|':UIView:0x7fca2a5310f0 )>", |
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
( | |
"<NSLayoutConstraint:0x7fdc79679380 H:[UIButton:0x7fdc796797b0(63)]>", | |
"<NSLayoutConstraint:0x7fdc79688fd0 H:[UIView:0x7fdc79688df0(1)]>", | |
"<NSLayoutConstraint:0x7fdc7967ab20 H:[UIButton:0x7fdc7967a950(140)]>", | |
"<NSLayoutConstraint:0x7fdc79689530 H:[UIView:0x7fdc79689450(1)]>", | |
"<NSLayoutConstraint:0x7fdc7967afe0 H:[UIButton:0x7fdc7967ada0(75)]>", | |
"<NSLayoutConstraint:0x7fdc79689b50 H:|-(8)-[UIButton:0x7fdc796797b0] (Names: '|':UIView:0x7fdc79688b70 )>", | |
"<NSLayoutConstraint:0x7fdc79689c40 H:[UIView:0x7fdc79688780]-(236)-| (Names: '|':UIView:0x7fdc79688b70 )>", | |
"<NSLayoutConstraint:0x7fdc79689c90 UIView:0x7fdc79688780.trailing == UIView:0x7fdc79688df0.trailing + 2>", | |
"<NSLayoutConstraint:0x7fdc79689d80 H:[UIButton:0x7fdc796797b0]-(8)-[UIView:0x7fdc79688c50]>", |
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 <stdio.h> | |
#include <stdlib.h> | |
bool dividerBy(char *number, int divider); | |
int main(){ | |
int flag = 0; | |
char year[1000]; | |
bool leap, huluculu, bulukulu; |
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
https://gist.github.com/pbassut/d7f483399d3a9df1f394#include <stdio.h> | |
#include <stdlib.h> | |
bool dividerBy(char *number, int divider); | |
int main(){ | |
int flag = 0; | |
char year[1000]; | |
bool leap, huluculu, bulukulu; |
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 <iostream> | |
#include <sstream> | |
#include <algorithm> | |
using namespace std; | |
bool isTheGreatest(int x, int y){ | |
static int greastest = 0; | |
if(x * y > greastest){ | |
greastest = x * y; |
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
const int greenLEDPin = 9; | |
const int redLEDPin = 11; | |
const int blueLEDPin = 10; | |
void changeLED(int r, int g, int b) { | |
analogWrite(greenLEDPin, r); | |
analogWrite(redLEDPin, g); | |
analogWrite(blueLEDPin, b); | |
} |
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
def count(numbers): | |
result = [] | |
for index, each in enumerate(numbers): | |
cpy = list(numbers) | |
del cpy[index] | |
result.append(reduce(lambda x, y: x * y, cpy)) | |
return result |
OlderNewer