Skip to content

Instantly share code, notes, and snippets.

View kylerush's full-sized avatar

Kyle Rush kylerush

  • New York, NY
View GitHub Profile
$("#second-reason").css({"left":"0px", "position":"relative", "top":"0px"});
$("#second-reason").detach().insertBefore("#first-reason");
$(".companies").css({"left":"0px", "position":"relative", "top":"0px"});
$(".companies").detach().insertBefore(".reasons");
@kylerush
kylerush / Gruntfile.js
Created September 16, 2014 12:54
Localization
lacalize: {
germany: {
options: {
exclude_files: ['website/usa/pages/**/*.html'],
exclude_yfm: 'germany'
}
source: 'website/usa',
dest: 'website/germany'
},
france: {
var getParameterByName = function (name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
if(getParameterByName(signup_text) === '1'){
jQuery('#signup-button').val('Get started');
@kylerush
kylerush / page.html
Created August 21, 2014 16:07
handlebars templates
<html>
<body>
<!-- the {{variable}} would not need to be translated, but the p tag string would need to be. -->
<script id="template">
<h1>{{variable}}</h1>
<p>This content would need to be translated.</p>
</script>
</body>
</html>
$('form :input').each(function(index, elem) {
var eId = $(elem).attr('id');
var label = null;
if (eId && (label = $(elem).parents('form').find('label[for='+eId+']')).length === 1) {
$(elem).attr('placeholder', $(label).html());
@kylerush
kylerush / twitterReferrals.js
Last active August 29, 2015 14:01
Use this custom JavaScript expression to target referrals from t.co in Optimizely
/^http\:\/\/t\.co\//.test(document.referrer);
<div class="clear code-block">
<pre class="brush: css">
body, html {background: #000; font-size: 12px;}
#container {width: 810px; margin: 0 auto 0 auto;}
#notice {color: #fff; font-weight: bold; font-size: 15px; font-style: italic;}
h1 {font-size: 38px; line-height: 45px;}
h1 span {font-size: 16px; color: #ff0084;}
h1 a:hover span {color: #fff;}
#tut-info {width: 810px; margin: 0 0 20px 0;}
#tut-info a {float: left; display: block; background: #fff; font-size: 20px; padding: 20px 20px; font-weight: bold; margin: 0 15px 0 0;}
<div class="clear code-block">
<pre class="brush: xml">
<div id="container">
<h1><a>DEMO: Use the Flickr API, JavaScript (jQuery), AJAX and JSON to Build a Photo Wall <span>by Kyle Rush</span></a></h1>
<a id="a-link" href="http://www.flickr.com/photos/kylerush/">Click Here to See My Flickr Photos</a>
<div id="tut-info" class="clearfix">
<a>View Tutorial &gt;&gt;</a>
<a>How to Use the Flickr API &gt;&gt;</a>
<a href="http://www.kylerush.net">kylerush.net &gt;&gt;</a>