I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!
\
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 'heavies_publish' | |
require 'launchy' | |
desc 'Publish the site' | |
task :publish => 'publish:publish' | |
namespace :publish do | |
include Heavies::Publish | |
directory Heavies::Publish.dir |
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
<% all_methods = self.class.superclass.instance_methods - self.class.superclass.superclass.instance_methods %> | |
<% output_helpers = ::Padrino::Helpers::OutputHelpers.instance_methods %> | |
<% tag_helpers = ::Padrino::Helpers::TagHelpers.instance_methods %> | |
<% asset_tag_helpers = ::Padrino::Helpers::AssetTagHelpers.instance_methods %> | |
<% form_helpers = ::Padrino::Helpers::FormHelpers.instance_methods %> | |
<% render_helpers = ::Padrino::Helpers::RenderHelpers.instance_methods %> | |
<% number_helpers = ::Padrino::Helpers::NumberHelpers.instance_methods %> | |
<% blog_helpers = Middleman::Blog::Helpers.instance_methods %> | |
<% mm_methods = all_methods - output_helpers - tag_helpers - asset_tag_helpers - form_helpers - render_helpers - number_helpers %> |
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 MyResource | |
include HTTParty | |
debug_output $stdout # <= will spit out all request details to the console | |
#... | |
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
# taken from: http://rhnh.net/2008/03/17/paypal-ipn-fails-date-standards | |
# parses PayPal non-standard format | |
DateTime.strptime("18:30:30 Jan 1, 2000 PST", "%H:%M:%S %b %e, %Y %Z").new_offset(0) | |
# in Rails you can use to_time_in_current_zone to convert it to TimeWithZone | |
DateTime.strptime("18:30:30 Jan 1, 2000 PST", "%H:%M:%S %b %e, %Y %Z").to_time_in_current_zone |
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
// this is the background code... | |
// listen for our browerAction to be clicked | |
chrome.browserAction.onClicked.addListener(function (tab) { | |
// for the current tab, inject the "inject.js" file & execute it | |
chrome.tabs.executeScript(tab.ib, { | |
file: 'inject.js' | |
}); | |
}); |
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
//DEFINE REGEX - valid input range is 100 thru 599 | |
var regEx = /^[1-5][0-9][0-9]$/ | |
//TEST REGEX | |
regEx.test(99) | |
=>false | |
regEx.test(100) | |
=>true |
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
https://chrome.google.com/webstore/detail/awesome-screenshot-captur/alelhddbbhepgpmgidjdcjakblofbmce | |
How many trackers does a single Chrome extension need? | |
Seven. | |
https://ssl.google-analytics.com/ (manifest.json, javascripts/cga.js) | |
https://cdn.extensionanalytics.com/ (manifest.json, javascripts/feedback.js) | |
https://pixel.getpaidfordata.com/ (manifest.json, background.html) | |
https://tags.crwdcntrl.net/ (manifest.json) |
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
headers = [ | |
{"Content-Type", "application/x-www-form-urlencoded"}, | |
{"Accept", "text/html"} | |
] | |
encoded_text = URI.encode_www_form(text) | |
body = "text=#{encoded_text}" | |
case HTTPoison.post(url, body, headers) do | |
{:ok, %HTTPoison.Response{status_code: 200, body: body}} -> |
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
var recognition; | |
function startRecognition() { | |
recognition = new webkitSpeechRecognition(); | |
recognition.onstart = function(event) { | |
updateRec(); | |
}; | |
recognition.onresult = function(event) { | |
var text = ""; | |
for (var i = event.resultIndex; i < event.results.length; ++i) { |