See how a minor change to your commit message style can make you a better programmer.
Format: <type>(<scope>): <subject>
<scope> is optional
Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.
For the sake of this example, let’s pretend the subfolder containing your site is named dist.
Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).
| ## Definition | |
| my_lambda= lambda {|x, y| puts x*y} | |
| my_lambda.call (12, 19) | |
| #if no arguments we can just call as | |
| my_lambda.call | |
| ## it can be called by using | |
| my_lambda_filter = lambda {|x| x> 10} | |
| [5,23,23].select(&my_lambda_filter) |
| peoples_ages = [25, 28, 36, 15, 17] | |
| # Definition | |
| ## First method | |
| my_proc = Proc.new {|n| n>30} | |
| ## Second method | |
| my_proc_two = proc {|n| n>12 } | |
| ## They can now be reused by calling | |
| e = peoples_ages.select(&my_proc) |
| def my_awesome_method ("Param1", &block) | |
| return to_enum(:each) unless block | |
| i = 0 | |
| while i < size: | |
| block.call at (i) | |
| end | |
| end |
| def white_flag | |
| puts "First code to run !" | |
| yield if block_given? | |
| puts "Last Code to execute !" | |
| end | |
| white_flag | |
| # "Hey guys !" | |
| # "nice to meet you." | |
| white_flag {p "I was the missing link !" } |
| import email | |
| import getpass, imaplib | |
| import os | |
| import sys | |
| from email.parser import HeaderParser | |
| import re | |
| class EmailDownloader: |
| def list_splitter(the_list, n): | |
| """Yield successive n-sized chunks from the list.""" | |
| for i in range(0, len(the_list), n): | |
| yield the_list[i:i + n] | |
| #Implementation | |
| import pprint | |
| pprint.pprint(list(list_splitter(range(10, 75), 10))) |
| from base64 import urlsafe_b64encode, urlsafe_b64decode | |
| from Crypto.Cipher import AES | |
| from Crypto import Random | |
| BS = 16 | |
| pad = lambda s: s + (BS - len(s) % BS) * chr(BS - len(s) % BS) | |
| unpad = lambda s: s[:-ord(s[len(s) - 1:])] | |
| base64pad = lambda s: s + '=' * (4 - len(s) % 4) |