Skip to content

Instantly share code, notes, and snippets.

View rotten77's full-sized avatar

Jan Zatloukal rotten77

View GitHub Profile
@rotten77
rotten77 / bs3-navbar-scroll.js
Last active August 29, 2015 14:05
Bootstrap 3 navbar scroll link
/**
* ScrollTo
*/
$('.scroll-link').on('click', function(event){
event.preventDefault();
var sectionID = $(this).attr("href");
$('html,body').animate({scrollTop: (sectionID=="#" ? 0 : $(sectionID).offset().top) }, 750, function(){
window.location.href = sectionID;
});
});
@rotten77
rotten77 / cm-custom-field-values.php
Created September 26, 2014 07:45
Campaign Monitor - update multi-options of custom field
/**
*=====================================================================
* Campaign Monitor API
* PHP library: http://campaignmonitor.github.io/createsend-php/
*/
define('API_KEY', '');
define('LIST_ID', '');
include_once dirname(__FILE__) . "/createsend-php/csrest_lists.php";
$wrap = new CS_REST_Lists(LIST_ID, API_KEY);
@rotten77
rotten77 / cm-update-subscriber.php
Created September 26, 2014 07:47
Campaign Monitor - update subscriber
/**
*=====================================================================
* Campaign Monitor API
* PHP library: http://campaignmonitor.github.io/createsend-php/
*/
define('API_KEY', '');
define('LIST_ID', '');
include dirname(__FILE__) . '/createsend-php/csrest_subscribers.php';
$wrap = new CS_REST_Subscribers(LIST_ID, API_KEY);
@rotten77
rotten77 / sublime-todone-check.sh
Last active August 29, 2015 14:07
ToDone (Sublime Text plugin) - Check *.todo files in folder and make a list of uncompletted tasks
#!/bin/bash
# https://sublime.wbond.net/packages/ToDone
# Check *.todo files in folder and make a list of uncompletted tasks
for f in *.todo
do
hasTasks=false
projectName="To do list"
projectTasks=""
IFS=''
# basic
RewriteEngine on
RewriteBase /
ErrorDocument 404 /404.html
# https
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# always "www" variant
@rotten77
rotten77 / add-jquery-bookmarklet.js
Created January 11, 2016 14:26
Add jQuery to site (bookmarklet)
javascript:(function(){var script = document.createElement('script');script.src = '//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js';document.getElementsByTagName('head')[0].appendChild(script);})();
@rotten77
rotten77 / blogger-rss-feed.php
Created February 4, 2016 08:42
Blogger.com RSS feed reader
<?php
$feed = file_get_contents('http://www.adsr.cz/feeds/posts/default');
$xml = simplexml_load_string($feed);
$items = array();
foreach($xml->entry as $entry) {
$url = null;
@rotten77
rotten77 / campaign-monitor-api-examples.php
Created March 9, 2016 06:25
Examples of usage of Campaign Monitor API
<?php
/**
*=====================================================================
* Campaign Monitor API
* PHP library: http://campaignmonitor.github.io/createsend-php/
*/
define('API_KEY', '');
define('LIST_ID', '');
var timer = setInterval(function(){
var moreLink = document.querySelectorAll('a.uiMorePagerPrimary');
if(moreLink.length>0) {
window.scrollTo(0,document.body.scrollHeight);
var i;
for (i = 0; i < moreLink.length; i++) {
moreLink[i].click();
}
} else {
console.clear();
@rotten77
rotten77 / obnova-hb.php
Created November 15, 2017 19:17
Automatická obnova inzerátů na Hudebnibazar.cz a MIDI.cz
<?php
/**
* Automatické prodloužení inzerátů na Hudebníbazar.cz
*/
define('EMAIL', '');
define('PASS', '');
// Základní nastavení
$curl = curl_init();
curl_setopt($curl, CURLOPT_COOKIEJAR, dirname(__FILE__) .'/cookie-hb.txt');
curl_setopt($curl, CURLOPT_URL, "https://hudebnibazar.cz/prihlasit/");