Skip to content

Instantly share code, notes, and snippets.

View preist's full-sized avatar
🏠
Working from home

Igor Putina preist

🏠
Working from home
View GitHub Profile
@preist
preist / download.sh
Created February 1, 2024 12:42
Fault tolerant image downloader for the Mixbook Blog
#!/bin/bash
# Author: Igor Putina
# Email: <igorputina@hey.com>
# Email: <iputina@mixbook.com>
# This script requires a file named 'filelist.txt' in the same directory, containing one image URL per line.
# It is designed to be fault-tolerant, attempting to download each file up to 5 times if the initial attempt fails.
# Downloads are saved to a './download' directory, which will be created if it doesn't exist.
# The script checks if a file already exists before downloading to avoid redundancy.
@preist
preist / convert.ts
Last active February 6, 2024 09:38
Convert Squarespace Export into a Cleaner XML
/**
* Squarespace Export to Clean HTML Converter
*
* Author: Igor Putina
* Email: <igorputina@hey.com>
* Email: <iputina@mixbook.com>
*
* This script processes a Squarespace export XML file and converts it into clean HTML
*
* Dependencies:
@preist
preist / example_hash
Last active November 13, 2019 15:53
Example hash string
65892e8d2a8aa4755424230ddffe97328583a332
@preist
preist / install_i3_gaps
Created December 9, 2018 13:10
Install i3-gaps on Ubuntu-like distros
#!/bin/bash
# created for installing i3-gaps over Ubuntu distros
# run with sudo
#-------------------------------------------------------------------------------
export DEBIAN_FRONTEND=noninteractive
apt-get update -q
apt-get upgrade -q -y
@preist
preist / data-href.js
Created June 28, 2018 20:02
Make any elements behave like a link
$(document).on("click", "[data-href]", function(e) {
return location.href = $(this).attr('data-href');
});
@preist
preist / react-swipeable-typescript-test-helper.ts
Created May 25, 2018 11:45
React Swipeable TypeScript Test Helpers
export type TouchEventMock = {clientX: number; clientY: number};
export type TouchEventMockObject = {touches?: TouchEventMock[]; changedTouches?: TouchEventMock[]};
function createClientXY(x: number, y: number): TouchEventMock {
return {clientX: x, clientY: y};
}
export function createStartTouchEventObject(x: number = 0, y: number = 0): TouchEventMockObject {
return {touches: [createClientXY(x, y)]};
}
@preist
preist / backbone-model-defaults.ts
Created December 19, 2017 07:30
Backbone model defaults in TypeScript
// Simpler Backbone model defaults in TypeScript
export class Person extends Backbone.Model {
constructor(options?: any) {
var defaults = {
name: 'Nameless',
occupation: 'Unemployed'
}
super(_.defaults(options, defaults));
@preist
preist / video-element.html
Created November 29, 2017 12:00
Enabling video for any image asset
<div class="image-container">
<img src="some/image.jpg" asset has-video="true" video="https://vimeo.com/232439739" />
</div>
@preist
preist / webpack.config.js
Created October 4, 2017 08:09
Make webpack and Backbone.js play nice
/* Make Webpack and Backbone play nice */
const path = require('path');
const webpack = require('webpack');
module.exports = {
entry: {
extract: './src/main.js'
},
output: {
@preist
preist / Capybara.md
Created May 17, 2017 11:47 — forked from tomas-stefano/Capybara.md
Capybara cheatsheet

Capybara Actions

# Anchor
click_link 'Save'

# Button
click_button 'awesome'

# Both above