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 urlrequested, COUNT(urlrequested) | |
FROM `wp_statpress` | |
WHERE urlrequested LIKE '%THEPOSTTITLES%' | |
GROUP BY urlrequested | |
ORDER BY COUNT(urlrequested) 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
UIImageView * roundedView = [[UIImageView alloc] initWithImage: [UIImage imageNamed:@"wood.jpg"]]; | |
// Get the Layer of any view | |
CALayer * l = [roundedView layer]; | |
[l setMasksToBounds:YES]; | |
[l setCornerRadius:10.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
- (NSString *)suffixForDayInDate:(NSDate *)date{ | |
NSInteger day = [[[[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar] components:NSDayCalendarUnit fromDate:date] day]; | |
if (day >= 11 && day <= 13) { | |
return @"th"; | |
} else if (day % 10 == 1) { | |
return @"st"; | |
} else if (day % 10 == 2) { | |
return @"nd"; | |
} else if (day % 10 == 3) { | |
return @"rd"; |
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 random | |
def print_word(word): | |
string = "" | |
for letter in word: | |
string += letter + ' ' | |
print(string) | |
def get_word(): | |
word_file = "/usr/share/dict/words" #only works for *nix users |
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 square_of_stars(n): | |
line = " * " * n | |
for i in range(n): | |
print (line) | |
def triangle(n): | |
for i in range(1, n+1): | |
print(" * " * i) | |
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 random | |
tablets = 5 | |
chance_dnd = 0.30 | |
chance_delayed = 0.30 | |
chance_arrived = 1.0 - chance_dnd - chance_delayed | |
runs = 1000 | |
total_failed = 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
NSNotificationCenter *notifyCenter = [NSNotificationCenter defaultCenter]; | |
[notifyCenter addObserverForName:nil | |
object:nil | |
queue:nil | |
usingBlock:^(NSNotification* notification){ | |
// Explore notification | |
NSLog(@"Notification found with:" | |
"\r\n name: %@" | |
"\r\n object: %@" | |
"\r\n userInfo: %@", |
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
defmodule Misc do | |
def multiply(x, y) do | |
x * y | |
end | |
end | |
defmodule MiscTest do | |
use ExUnit.Case | |
doctest Misc | |
test "multiplying two numbers returns the product" do |
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
defmodule Misc do | |
@moduledoc """ | |
This contains some functions for learning Elixir. | |
""" | |
@doc """ | |
This multiplies two values. | |
Examples: | |
iex> Misc.multiply(3,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
@doc """ | |
iex>Misc.sum([1,1,1]) | |
3 | |
iex>Misc.sum([1, 2, 3, 4, 5]) | |
15 | |
""" | |
def sum(list) do | |
_sum(list, 0) | |
end |
OlderNewer