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
is_landscape : -> | |
really_landscape = => | |
w = $(window) | |
w.width() >= w.height() | |
if @options.state.device.desktop | |
really_landscape() | |
else if window.orientation? | |
Math.abs(window.orientation) is 90 | |
else if window.matchMedia? |
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
is_event_supported : (event) -> | |
eventName = "on#{event}" | |
element = document.createElement('div') | |
supported_in_ff = -> | |
element.setAttribute eventName, 'return;' | |
typeof element[eventName] is 'function' | |
supported = eventName in element || supported_in_ff() | |
element = null |
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
-- Change all http:// references to https:// | |
UPDATE wp_posts SET post_content=REPLACE(post_content, 'http://', 'https://'); | |
-- Change site's url and homepage | |
UPDATE wp_options SET option_value=REPLACE(option_value, 'http://', 'https://') WHERE option_name IN ('siteurl', 'home'); |
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
CREATE VIEW emails AS ( | |
SELECT email FROM users | |
UNION | |
SELECT other_email AS email FROM more_users | |
UNION | |
select other_other_email AS email FROM even_more_users | |
); | |
SELECT 1 FROM emails WHERE email = 'email@email.com'; |
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
# /var/log/nginx/conf.d/mobile.conf | |
map $http_user_agent $mobile { | |
default 0; | |
~*(android|bb\d+|meego).+mobile|ip(hone|od)|opera\sm(ob|in)i|mobile.+firefox 1; | |
~*iemobile|phone|symbian|windows\sce|blackberry|up\.(browser|link) 1; | |
~*avantgo|bada\/|blazer|compal|elaine|fennec|hiptop|iris|kindle|lge\s|maemo 1; | |
~*midp|mmp|netfront|palm(\sos)?|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0 1; | |
~*treo|vodafone|wap|xda|xiino 1; | |
~*^(1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a\swa|abac|ac(er|oo|s\-)) 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
# /var/log/nginx/conf.d/mobile.conf | |
map $http_user_agent $mobile { | |
default 0; | |
~*(android|bb\d+|meego).+mobile|ip(hone|od)|opera\sm(ob|in)i|mobile.+firefox 1; | |
~*iemobile|phone|symbian|windows\sce|blackberry|up\.(browser|link) 1; | |
~*avantgo|bada\/|blazer|compal|elaine|fennec|hiptop|iris|kindle|lge\s|maemo 1; | |
~*midp|mmp|netfront|palm(\sos)?|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0 1; | |
~*treo|vodafone|wap|xda|xiino 1; | |
~*^(1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a\swa|abac|ac(er|oo|s\-)) 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
RewriteCond %{QUERY_STRING} ^lang=(\w{2})/(.*)$ | |
RewriteRule .* http://%1.example.com/%2 [L,R=301] |
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
def z_score(variation_id) | |
# Taken from https://github.com/andrew/split/blob/master/lib/split/zscore.rb | |
n_1 = views_count(variation_id).to_f | |
n_2 = views_count(popup_id).to_f | |
p_1 = conversion_rate(variation_id) | |
p_2 = conversion_rate(popup_id) | |
if n_1 < 30 || n_2 < 30 || (p_1 * n_1 < 5) || (p_2 * n_2 < 5) | |
return false | |
end |
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
module RailsWithNg | |
class Application < Rails::Application | |
[...] | |
config.assets.paths << Rails.root.join('app', 'ng') | |
# Add bower CSS components | |
bower_path = Rails.root.join('vendor', 'assets', 'bower_components') | |
config.assets.paths << bower_path | |
config.sass.load_paths << bower_path |
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
<script> | |
////// START EDITING HERE | |
var utmx_key = 'XXXXXXX-X', // change this to your experiment key | |
show_on = 'mobile', // Can be 'mobile' or 'desktop' | |
///// STOP EDITING HERE | |
/////////////////////////// | |
is_mobile = function () { | |
return /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera\s?mini/i.test(navigator.userAgent.toLowerCase()); | |
}, |
NewerOlder