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
@try | |
{ | |
NSUndoManager* undoManager = [self undoManager]; | |
id undostack = object_getIvar(undoManager, class_getInstanceVariable([NSUndoManager class], "_undoStack")); | |
id redostack = object_getIvar(undoManager, class_getInstanceVariable([NSUndoManager class], "_redoStack")); | |
NSLog(@"%@",[NSString stringWithFormat:@"(%lu entries) %@", (unsigned long)[undostack count], [undostack description]]); | |
NSLog(@"%@",[NSString stringWithFormat:@"(%lu entries) %@", (unsigned long)[redostack count], [redostack description]]); | |
} |
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
id undostack = object_getIvar(undoManager, class_getInstanceVariable([NSUndoManager class], NEVER_TRANSLATE("_undoStack"))); | |
id headAction = object_getIvar(undostack, class_getInstanceVariable([undostack class], NEVER_TRANSLATE("_head"))); | |
id nextAction = object_getIvar(headAction, class_getInstanceVariable([headAction class], NEVER_TRANSLATE("next"))); | |
const char *beginGroupName = NEVER_TRANSLATE("_NSUndoBeginMark"); | |
const char *nextActionName = object_getClassName(nextAction); | |
if( strcmp(beginGroupName,nextActionName) == 0 ) | |
{ | |
[undoManager undo]; | |
} |
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
inputNum = 1234 | |
reverseNum = 0 | |
while inputNum > 0: | |
reverseNum = (reverseNum*10) + (inputNum%10) | |
inputNum = inputNum/10 | |
print reverseNum |
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
# Write a function that takes a head node; | |
# then iterates through a singly-linked list starting from the head node, and remove any nodes that have duplicate values | |
class Node(): | |
def __init__(self, value): | |
self.value = value | |
self.next = None | |
myNode1 = Node(1) |
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
# Write a method that takes a single integer and prints that integer to the power of 100 | |
firstNum = 3 | |
numArray = [firstNum] | |
for i in range(0,99): | |
previousCarry = 0 | |
lastValue = 0 | |
lengthOfArray = len(numArray) | |
for j in range(0,lengthOfArray): | |
newProduct = firstNum * numArray[j] + previousCarry |
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 addObserver:selector:name:object:] | |
and | |
-[NSNotificationCenter addObserverForName:object:queue:usingBlock:] | |
With the condition: | |
(BOOL)[@"fractionCompleted" isEqualToString:(id)$r8] | |
and | |
(BOOL)[@"fractionCompleted" isEqualToString:(id)$rdx] |
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
#NOTE: #### denotes additions to the code between questions | |
#Find the length of a string | |
#Nerf toss question to warm them up | |
#Write a function that takes two strings, and find if the first string contains the second string | |
def findSubstring( main, sub ): |
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 csv | |
import requests | |
GITHUB_USER = '' | |
GITHUB_PASSWORD = '' | |
REPO = 'TechSmith/Snagit' # format is username/repo | |
ISSUES_FOR_REPO_URL = 'https://api.github.com/repos/techsmith/snagit/issues?state=closed&labels=Bug' | |
AUTH = (GITHUB_USER, GITHUB_PASSWORD) |
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 csv | |
import requests | |
import re | |
try: | |
from bs4 import BeautifulSoup | |
except ImportError: | |
from BeautifulSoup import BeautifulSoup | |
g2URL = 'https://www.g2crowd.com/products/snagit/reviews?page=' |
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
Write a text autocorrect app | |
We provide small dictionary (100 words) | |
Project Specifications: | |
Write an application that takes a string, and has a button that tells you if the word is valid or not. | |
We will provide a dictionary, with valid words delimited by newlines. | |
If the word is not valid, display a suggested word and give the user an option to change their word to the suggested word. | |
Add a button that adds the current inputted word into the dictionary |
OlderNewer