var divs = $("div");
var divs = document.querySelectorAll("div");
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
chrome.tabs.query( | |
{ active: true, windowId: chrome.windows.WINDOW_ID_CURRENT }, | |
function(tabs) { | |
const { id: tabId } = tabs[0].url; | |
let code = `document.querySelector('h1')`; | |
// http://infoheap.com/chrome-extension-tutorial-access-dom/ | |
chrome.tabs.executeScript(tabId, { code }, function (result) { | |
// result has the return value from `code` |
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
~/dev/real-world-rails (master) | |
$ ag -G 'config/initializers/' ::DATE_FORMATS | |
apps/accelerated_claims/config/initializers/date_formats.rb | |
1:Date::DATE_FORMATS[:printed] = '%d %B %Y' | |
apps/advocate-defence-payments/config/initializers/date_time.rb | |
2:Date::DATE_FORMATS[:default] = Settings.date_format | |
5:DateTime::DATE_FORMATS[:default] = Settings.date_time_format | |
8:Time::DATE_FORMATS[:default] = Settings.date_time_format |
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
ruby '2.7.1' | |
gem 'rails', github: 'rails/rails' | |
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data | |
# Action Text | |
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra' | |
gem 'okra', github: 'basecamp/okra' | |
# Drivers |
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 Foundation | |
import CFNetwork | |
public class FTPUpload { | |
fileprivate let ftpBaseUrl: String | |
fileprivate let directoryPath: String | |
fileprivate let username: String | |
fileprivate let password: String |
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 Alamofire | |
func makeGetCallWithAlamofire() { | |
let todoEndpoint: String = "https://jsonplaceholder.typicode.com/todos/1" | |
Alamofire.request(todoEndpoint) | |
.responseJSON { response in | |
// check for errors | |
guard response.result.error == nil else { | |
// got an error in getting the data, need to handle it | |
print("error calling GET on /todos/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
# Find all the available rules by running: | |
# swiftlint rules | |
disabled_rules: # rule identifiers to exclude from running | |
# - colon | |
# - comma | |
- control_statement | |
# - trailing_whitespace | |
opt_in_rules: # some rules are only opt-in | |
- empty_count |
MailChimp's default popup scripts can break on WordPress sites that use jQuery/jQuery UI unless you include their embed code as the final elements before the closing body tag.
Including them in this way isn't always possible or easy with WordPress.
The code below is an alternative implementation of the loader that forces MailChimp's popup scripts to appear below all other scripts upon page load.
To use it, modify the baseUrl
, uuid
, and lid
attributes with the ones from the original popup script that MailChimp supplies.
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
<?php | |
/** | |
* Add a filter to stylesheet_uri, which appends a query string to it automagically. | |
*/ | |
add_filter('stylesheet_uri', 'zk_css_versioner'); | |
/** | |
* the goal of this method is to append a query string to the css url for the site. | |
* the query string currently is determined by the last time the css file was modified |
NewerOlder