// jQuery
$(document).ready(function() {
// 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
| var elements = document.querySelectorAll("div"), | |
| callback = (el) => { console.log(el); }; | |
| // Spread operator | |
| [...elements].forEach(callback); | |
| // Array.from() | |
| Array.from(elements).forEach(callback); | |
| // for...of statement |
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
| # lib/api_constraints.rb | |
| class ApiConstraints | |
| def initialize(options) | |
| @version = options[:version] | |
| @default = options[:default] | |
| @domain = options[:domain] | |
| end | |
| def matches?(req) |
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
| /** | |
| * Custom WP gallery | |
| */ | |
| add_shortcode('gallery', 'my_gallery_shortcode'); | |
| function my_gallery_shortcode($attr) { | |
| $post = get_post(); | |
| static $instance = 0; | |
| $instance++; |
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
| INSERT INTO `redirects` (`match`, `redirect_to`, `account_id`, `created_at`, `updated_at`) | |
| VALUES | |
| ('/old_page.php', '/new/page', 40, NOW(), NOW()), | |
| ('/old_page_two.php', '/new/page/two', 40, NOW(), NOW()), | |
| ('/old_page_three.php', '/new/page-two', 40, NOW(), NOW()); |
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
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Fuzzy Search</title> | |
| </head> | |
| <body> | |
| <input type="search" class="search"> | |
| <p class="response"></p> | |
| <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> |
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
| // Countdown.js | |
| // A plugin to generate a countdown to a date. | |
| // version 1.0, January 2013 | |
| // by Andrew Anderson | |
| ;(function ( $, window, document, undefined ) { | |
| var pluginName = "countdown", | |
| defaults = { | |
| year: "", |
Prereq:
apt-get install zsh
apt-get install git-coreGetting zsh to work in ubuntu is weird, since sh does not understand the source command. So, you do this to install zsh
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh
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
| # ... | |
| gem 'carrierwave' | |
| gem 'fog', '~> 1.0.0' # Need to specify version, as carrierwave references older (0.9.0) which doesn't allow configuration of Rackspace UK Auth URL |
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
| /* | |
| * Normalized hide address bar for iOS & Android | |
| * (c) Scott Jehl, scottjehl.com | |
| * MIT License | |
| */ | |
| (function( win ){ | |
| var doc = win.document; | |
| // If there's a hash, or addEventListener is undefined, stop here | |
| if( !location.hash && win.addEventListener ){ |