Skip to content

Instantly share code, notes, and snippets.

View martinjinda's full-sized avatar
💩

Martin Jinda martinjinda

💩
View GitHub Profile
@martinjinda
martinjinda / Leverage Mailchimp data
Last active April 9, 2020 12:49
Leverage Mailchimp data and sort based on sent time
function chimpCampaigns() {
var API_KEY = '95610c4b1779a8a5852f4f7c8dfab953-us1'; // MailChimp API Key
var REPORT_START_DATE = '2020-01-01 07:00:00';
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName("CampaignData");
var dc = API_KEY.split('-')[1];
var api = 'https://'+ dc +'.api.mailchimp.com/3.0';
var count = 100; // Max rows to return
@martinjinda
martinjinda / Reading progress bar
Created January 28, 2020 11:54
Reading progress bar
if ($('.post').length) {
let winHeight = $(window).height(),
docHeight = $('.post').height(),
postOffset = $('.post').offset().top,
progressBar = $('.progress-container'),
max, value;
max = docHeight - winHeight;
progressBar.attr('max', max);
@martinjinda
martinjinda / ICS.php
Created March 6, 2018 11:37 — forked from jakebellacera/ICS.php
A convenient script to generate iCalendar (.ics) files on the fly in PHP.
<?php
/**
* ICS.php
* =======
* Use this class to create an .ics file.
*
* Usage
* -----
* Basic usage - generate ics file contents (see below for available properties):
@martinjinda
martinjinda / find_page_title.php
Created November 13, 2017 14:55
Find page title
<?php
$fp = fopen("http://www.example.com","r");
while (!feof($fp) ){
$page .= fgets($fp, 4096);
}
$titre = eregi("<title>(.*)</title>",$page,$regs);
echo $regs[1];
fclose($fp);
@martinjinda
martinjinda / Basic Gulp setting for web development
Last active May 17, 2016 09:36
Setting for compiling SCSS files + automatic refresh in browser (watching index.html + all scss files)
var gulp = require('gulp');
var browserSync = require('browser-sync');
var sass = require('gulp-sass');
var cleanCSS = require('gulp-clean-css');
gulp.task('sass', function(){
return gulp.src('dist/scss/main.scss')
.pipe(sass())
.pipe(cleanCSS({compatibility: 'ie8'}))
.pipe(gulp.dest('src/css'))
@martinjinda
martinjinda / Retina-image SCSS mixin
Last active April 20, 2016 11:59
Mixin for easier adding Retina ready images
.img-retina(@file-1x; @file-2x; @width-1x; @height-1x) {
background-image: url("@{file-1x}");
@media
only screen and (-webkit-min-device-pixel-ratio: 2),
only screen and ( min--moz-device-pixel-ratio: 2),
only screen and ( -o-min-device-pixel-ratio: 2/1),
only screen and ( min-device-pixel-ratio: 2),
only screen and ( min-resolution: 192dpi),
only screen and ( min-resolution: 2dppx) {
@martinjinda
martinjinda / jQuery Change Event: Proper Binding
Created September 23, 2015 11:22 — forked from brandonaaskov/jQuery Change Event: Proper Binding
jQuery's change() event doesn't work as expected with input text fields. This, however, does work.
/*
For some reason, the change() event only fires when the input field loses focus.
Binding to other options ('change keypress paste focus textInput input') will
fire the event several times, which is bad. The below code works even when
content is pasted into the text field, and only fires once as expected.
*/
$('#search-form .term').bind('input', function(){
console.log('this actually works');
});