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
from selenium import webdriver | |
from selenium.common.exceptions import TimeoutException | |
import selenium.webdriver.support.wait | |
selenium.webdriver.support.wait.POLL_FREQUENCY = 0.05 | |
import re | |
import random | |
import collections | |
class AdwordsAutomater(object): |
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
// clang -fobjc-arc -framework Foundation runtime-class.m | |
#import <Foundation/Foundation.h> | |
#import <objc/runtime.h> | |
@interface Person : NSObject | |
- (id)initWithFirstName: (NSString *)firstName lastName: (NSString *)lastName age: (NSUInteger)age; |
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
Red [ | |
Title: "Calculator" | |
File: %calculator.r | |
Version: 0.0.1 | |
;Date: 18-Jun-2016 | |
Author: [ | |
REBOL version ["Jeff Kreis" "Allen Kamp" "Carl Sassenrath"] | |
Red port "Gregg Irwin" | |
] | |
Purpose: "Simple numeric calculator." |
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
/* This is specific fix for a problem with the windows SDK headers when */ | |
/* using MSVC with an x86 compilation target. On x64 the SDK would enable */ | |
/* MSVC's _InterlockedSomething compiler intrinsics and use #define to make */ | |
/* sure those are used instead of InterlockedSomething library calls. On */ | |
/* x32 it doesn't even though MSVC does support many of those intrinsics. */ | |
/* Including this header fixes that. */ | |
#ifndef _MSVC_INTRINSICS_H | |
#define _MSVC_INTRINSICS_H |
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
Am I out of order being annoyed at things like this? The naming has changed subtly, the direction is at the end in UIKit but at the start on AppKit. If I'm writing cross platform code then I need to either use the int values directly, which is bad practice, or use a define. | |
UIKit: | |
enum { | |
NSTextAlignmentLeft = 0, | |
NSTextAlignmentCenter = 1, | |
NSTextAlignmentRight = 2, | |
NSTextAlignmentJustified = 3, | |
NSTextAlignmentNatural = 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
CGFloat GetLineHeightForFont(CTFontRef iFont) | |
{ | |
CGFloat lineHeight = 0.0; | |
check(iFont != NULL); | |
// Get the ascent from the font, already scaled for the font's size | |
lineHeight += CTFontGetAscent(iFont); | |
// Get the descent from the font, already scaled for the font's size |
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
CFMutableAttributedStringRef attributedString = NULL; | |
CFRange stringRange = CFRangeMake(0, CFAttributedStringGetLength(attributedString)); | |
//color | |
CGColorRef stringColor = nil; | |
CGColorSpaceRef rgbColorSpace = CGColorSpaceCreateDeviceRGB(); | |
CGFloat colorComponents[] = {0.0f, 0.0f, 0.0f, 1.0f}; | |
stringColor = CGColorCreate(rgbColorSpace, colorComponents); | |
CGColorSpaceRelease(rgbColorSpace); | |
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
; A minimal Mach-o x64 executable for OS X (also see below Mountain Lion version) | |
; | |
; $ nasm -f bin -o tiny_hello tiny_hello.s | |
; $ chmod +x tiny_hello | |
; $ ./tiny_hello | |
; Hello World! | |
; $ | |
; c.f. | |
; http://osxbook.com/blog/2009/03/15/crafting-a-tiny-mach-o-executable/ ( the original tiny mach-o executable ) |
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 <objc/runtime.h> | |
#include <objc/message.h> | |
#include <CoreFoundation/CoreFoundation.h> | |
/* ... */ | |
/** | |
* Return a character string that holds the current version | |
* of the operating system which is equivalent to: |
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
system/view/auto-sync?: no | |
grid: collect [repeat i 50 [keep/only collect [repeat j 50 [keep random true]]]] | |
scratchgrid: collect [repeat i 50 [keep/only collect [repeat j 50 [keep false]]]] | |
a: copy grid/1 | |
b: copy grid/50 | |
c: collect [keep/only b keep grid keep/only a] | |
count-neighbors: function [gridd x y][ |
OlderNewer