Skip to content

Instantly share code, notes, and snippets.

View mcdemidov's full-sized avatar

Mikhail Demidov mcdemidov

View GitHub Profile
@mcdemidov
mcdemidov / ch-bg.js
Last active August 29, 2015 14:25
change class
var i = -1, bghead = ["bg", "bg1", "bg2", "bg3", "bg4", "bg5"] ;
$(".butt-next").click(function () {
$("header").removeClass(bghead[i % bghead.length])
$("header").addClass(bghead[++i% bghead.length])
});
@mcdemidov
mcdemidov / e_conf.js
Last active August 29, 2015 14:26
email confirm google forms
function emailConfirm(){
var sheet = SpreadsheetApp.getActiveSheet();
var numRows = sheet.getLastRow();
var dataRange = sheet.getRange(1, 1, numRows, 6)
var data = dataRange.getValues();
for (var i = 0; i < data.length; ++i)
{
var row = data[i];
var name = row[1];
var phone = row[2];
@mcdemidov
mcdemidov / gist:cf8c7bde3253bd30bf45
Last active August 29, 2015 14:26 — forked from madysondesigns/gist:3237574
Google Docs Forms
<script type="text/javascript">var submitted=false;</script>
//This is where thank you page/message is loaded. Replace onload function with jQuery hide/show or page redirect to separate page {window.location='thankyou.html';}.
<iframe name="hidden_iframe" id="hidden_iframe" style="display:none;" onload="if(submitted) {$('#formblock').hide(); $('#thankyou').fadeIn('fast');}"></iframe>
//replace form key with actual key from Google Docs
<form action="https://docs.google.com/a/betterment.com/spreadsheet/formResponse?formkey=dGlUczJTRUNjaHExOGtqZkVCYjVtR3c6MQ&amp;ifq" method="post" target="hidden_iframe" id="commentForm" onsubmit="submitted=true;">
<div id="formblock">
//recreate form fields and validation if needed
@mcdemidov
mcdemidov / email encode php
Created October 15, 2015 14:25
email encode php
$to = '';
$subject = '=?utf-8?B?'.base64_encode('Новое сообщение!').'?=';
$headers = 'From: =?UTF-8?B?' . base64_encode($name) . '?= <=?UTF-8?B?' . base64_encode($name) . "?=>\r\n";
$headers .= 'Return-path: <' . $email . ">\r\n";
$headers .= 'Content-type: text/plain; charset=utf-8' . "\r\n";
$headers .= 'Content-Transfer-Encoding: quoted-printable' . "\r\n\r\n";
$message = "Новый запрос!\n\nИмя: $name\n\nEmail: $email\n\nТелефон: $tel\n\n";
$mail = mail($to, $subject, $message, $headers);
@mcdemidov
mcdemidov / gist:f68b5ce354eef5617dc4
Created October 27, 2015 07:23
WordPress query_posts
<?php if ( have_posts() ) : query_posts('p=1');
while (have_posts()) : the_post(); ?>
<?php the_title(); ?>
<?php the_content(); ?>
<?php the_post_thumbnail(array(100, 100)); ?>
<? endwhile; endif; wp_reset_query(); ?>