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
    
  
  
    
  | jQuery Traversing Methods | |
| ######################### | |
| Three types: | |
| 1) Filtering | |
| ------------ | |
| .eq() | |
| .filter() | 
  
    
      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
    
  
  
    
  | // The code sample below uses both the .not() method and the .parent() method. | |
| // Combined together this will only select the parent elements of div elements | |
| // without a class of type or collection. | |
| $('div').not('.type, .collection').parent(); | 
  
    
      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
    
  
  
    
  | // In the example below the original selection finds all of the div elements in the DOM, | |
| // which are then filtered using the .not() method. With this specific method all of the | |
| // div elements without a class of type or collection will be selected. | |
| $('div').not('.type, .collection'); | 
  
    
      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
    
  
  
    
  | // When working inside of a jQuery function you may want to select the element in which was referenced | |
| // inside of the original selector. In this event the this keyword may be used to refer to the element | |
| // selected in the current handler. | |
| $('div').click(function(event){ | |
| $(this); | |
| }); | 
  
    
      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
    
  
  
    
  | $('.feature'); // Class selector | |
| $('li strong'); // Descendant selector | |
| $('em, i'); // Multiple selector | |
| $('a[target="_blank"]'); // Attribute selector | |
| $('p:nth-child(2)'); // Pseudo-class selector | 
  
    
      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
    
  
  
    
  | $(document).ready(function(event){ | |
| // jQuery code | |
| }); | 
  
    
      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
    
  
  
    
  | # PYTHON TIPS AND TRICKS FROM Alexis Métaireau | |
| # http://alexis.notmyidea.org/pythontricks/ | |
| import string | |
| from collections import namedtuple | |
| from collections import Counter | |
| # STRINGS | |
| print 'hackers gonna hack'. partition(' ') # partition the first space | 
  
    
      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
    
  
  
    
  | import os | |
| path = os.getcwd() | |
| for root, dirs, files in os.walk(path): | |
| print("visiting: ", root) | |
| os.chdir(root) | |
| py_files = [file for file in files if file[-3:]=='.py'] | |
| for py_file in py_files: | |
| cmd = "python {0}".format(py_file) | |
| print("running: ", cmd) | 
  
    
      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
    
  
  
    
  | import twitter, sys, getpass, os | |
| def call_api(username,password): | |
| api = twitter.Api(username,password) | |
| friends = api.GetFriends() | |
| followers = api.GetFollowers() | |
| heathens = filter(lambda x: x not in followers,friends) | |
| print "There are %i people you follow who do not follow you:" % len(heathens) | |
| for heathen in heathens: | |
| print heathen.screen_name |