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
| require 'ap' | |
| require 'mail' | |
| # String monkeypatch | |
| # This is one of many possible "encoding problem" solutions. It's actually an intractable problem | |
| # but you'd have to read "Gödel, Escher, Bach" to understand why... | |
| class String | |
| def clean_utf8 | |
| # self.force_encoding("UTF-8").encode("UTF-16BE", :invalid=>:replace, :replace=>"?").encode("UTF-8") | |
| unpack('C*').pack('U*') if !valid_encoding? |
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
| ############################ | |
| ### CDOLLA CDOLLA CDOLLA ### | |
| ### CDOLLA CDOLLA CDOLLA ### | |
| ### CDOLLA CDOLLA CDOLLA ### | |
| ### CDOLLA CDOLLA CDOLLA ### | |
| ############################ | |
| ### | |
| ### |
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
| brew install caskroom/cask/brew-cask | |
| brew cask install atom | |
| apm install linter # Base linter | |
| apm install linter-ruby | |
| apm install linter-scss-lint | |
| apm install linter-coffeelint | |
| apm install linter-rubocop | |
| apm install linter-haml |
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
| *nat | |
| :PREROUTING ACCEPT [0:0] | |
| :INPUT ACCEPT [0:0] | |
| :OUTPUT ACCEPT [0:0] | |
| :POSTROUTING ACCEPT [0:0] | |
| # p4p1 is WAN interface, #p1p1 is LAN interface | |
| -A POSTROUTING -o p4p1 -j MASQUERADE | |
| # NAT pinhole: HTTP from WAN to LAN |
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
| #!/usr/bin/ruby | |
| #The 2010 Census puts populations of 26 largest US metro areas at | |
| #18897109, 12828837, 9461105, 6371773, 5965343, 5946800, 5582170, 5564635, 5268860, 4552402, 4335391, 4296250, 4224851, 4192887, 3439809, 3279833, 3095313, 2812896, 2783243, 2710489, 2543482, 2356285, 2226009, 2149127, 2142508, and 2134411. | |
| #Can you find a subset of these areas where a total of exactly 100,000,000 people live, | |
| #assuming the census estimates are exactly right? Provide the answer and code or reasoning used. | |
| populations = [18897109, 12828837, 9461105, 6371773, 5965343, 5946800, 5582170, 5564635, 5268860, 4552402, 4335391, 4296250, 4224851, 4192887, 3439809, 3279833, 3095313, 2812896, 2783243, 2710489, 2543482, 2356285, 2226009, 2149127, 2142508, 2134411] | |
| target = 100000000 |
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
| class MyController < ApplicationController | |
| before_filter :get_small_list | |
| def index | |
| #can now access the @small_list in the index | |
| end | |
| end |
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
| def get_small_list | |
| @small_list = fetch_url "http://myurl.com/small-list.html" | |
| end |
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
| def fetch_url(url) | |
| r = Net::HTTP.get_response( URI.parse( url ) ) | |
| if r.is_a? Net::HTTPSuccess | |
| r.body.force_encoding("UTF-8") | |
| else | |
| nil | |
| end | |
| end |
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
| <ul> | |
| <li>I am the first element in the list</li> | |
| <li>I am the second element in the list</li> | |
| <li>I am the last element in the list</li> | |
| </ul> |
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
| powershell "dir -recurse -include *.tif | %{mogrify -compress Group4 $_.FullName}" |
NewerOlder