Skip to content

Instantly share code, notes, and snippets.

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

Stanislav (Stas) Katkov skatkov

🏠
Working from home
View GitHub Profile
@skatkov
skatkov / lefthook.yml
Created June 10, 2020 12:25
lefthook config
pre-commit:
parallel: true
commands:
eslint:
glob: "*.{js}"
run: yarn prettier --write {staged_files} && yarn eslint {staged_files} && git add {staged_files}
css:
glob: "*.{css}"
run: yarn prettier --write {staged_files} && git add {staged_files}
rubocop:
@skatkov
skatkov / bundle-checkinstall
Last active April 10, 2020 23:16
lefthook.yml
#!/bin/bash
BRANCH_CHANGE=$3
[[ $BRANCH_CHANGE -eq 0 ]] && exit
PREV_HEAD=$1
CURR_HEAD=$2
[ $PREV_HEAD == $CURR_HEAD ] && exit
# Don't run bundler if there were no changes in gems
@skatkov
skatkov / .env
Last active April 8, 2023 10:08
Progressive mailchimp subscription on Netlify
MAILCHIMP_API_KEY="...-us19"
MAILCHIMP_LIST_ID="..."
@skatkov
skatkov / subscribe.js
Created August 30, 2019 15:43
netlify function: mailchimp subscribe
/* eslint-disable */
const axios = require('axios');
require('dotenv').config();
exports.handler = function(event, context, callback) {
const password = process.env.MAILCHIMP_API_KEY;
console.log(password);
if (!password) {
console.error('No MailChimp API Key include in environment variables');
process.exit(1);
### Keybase proof
I hereby claim:
* I am skatkov on github.
* I am skatkov (https://keybase.io/skatkov) on keybase.
* I have a public key ASDWCFGd352PjfJK8TGdTs4v1UJIgKEW8mOc8jJwECTOBQo
To claim this, I am signing this object:
@skatkov
skatkov / wip_graphql_demo.rb
Created May 2, 2018 07:40 — forked from marckohlbrugge/wip_graphql_demo.rb
Ruby example of creating a todo and then completing it using wip.chat graphql.
# NOTE: Be sure to set the API key further down in the code!
require "net/http"
require "uri"
require "json"
class WIP
def initialize(api_key:)
@api_key = api_key
end
@skatkov
skatkov / string_auto_clear.rb
Last active January 29, 2018 16:29
String removal from malloc
class String
def auto_clear
begin
result = yield self
result.equal?(self) ? nil : result # avoid leaking
ensure
clear
end
end
end
@skatkov
skatkov / tsheets_users_controller.rb
Created October 27, 2017 12:57
TypeError: superclass mismatch for class UsersController
#file: app/controllers/tsheets/users_controller.rb
module Tsheets
class UsersController < ApplicationController
def update
# does something important here
render json: 'test: test'
end
end
end
GEM
remote: https://rubygems.org/
specs:
enumerable-lazy (0.0.2)
ffi (1.9.18)
haml (5.0.3)
temple (>= 0.8.0)
tilt
i18n (0.8.6)
mail (2.6.6)
@skatkov
skatkov / Gemfile
Created August 22, 2017 07:36
sep-contentino-comments
source 'https://rubygems.org'
ruby '2.4'
gem 'faker'
gem 'watir'
gem 'selenium-webdriver'
gem 'pry'