Skip to content

Instantly share code, notes, and snippets.

@spk
spk / deploy.yaml
Created January 7, 2020 10:36
Github Action Heroku Git Deploy
# https://github.com/marketplace/actions/checkout
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows#issue-comment-event-issue_comment
# https://devcenter.heroku.com/changelog-items/775
# https://github.com/actions/checkout#fetch-all-history-for-all-tags-and-branches
# https://github.com/cirrus-actions/rebase#installation
# https://github.com/actions/heroku/issues/10
---
name: Deploy to HEROKU_APP_NAME
on:
@spk
spk / Dockerfile
Created October 23, 2019 19:38
docker lua pretty build
FROM alpine
RUN apk add --no-cache \
bash \
build-base \
ca-certificates \
cmake \
curl \
gcc \
git \
@spk
spk / LICENSE.md
Last active February 1, 2017 16:18 — forked from tommaybe/LICENSE.md
Day / Hour Heatmap

Copyright (c) 2016, Tom May

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTH

diff --git a/app/models/version.rb b/app/models/version.rb
index e8eed16..a3a4ba1 100644
--- a/app/models/version.rb
+++ b/app/models/version.rb
@@ -36,10 +36,10 @@ class Version < ActiveRecord::Base
GemDownload.create!(count: 0, rubygem_id: rubygem_id, version_id: id)
end
- def self.reverse_dependencies(name)
+ def self.reverse_dependencies_by(**kwargs)
@spk
spk / alternative-ruby.sh
Created February 3, 2016 15:47
Quick Ruby alternative on Debian
RV=2.2; dpkg -L ruby$RV | grep 'bin/' | grep -v grep | awk '{print "ln -fs "$1" "$1}' | sed s/$RV//2 | sed 's/\/usr/$HOME/2' | sh
@spk
spk / bundler.cap
Created May 20, 2015 14:23
Bundler check install capistrano 3
namespace :bundler do
task :check_install do
on roles(:app) do
with rails_env: fetch(:rails_env) do
execute 'gem query --local | grep bundler || gem install bundler'
end
end
end
end
@spk
spk / clock.sh
Last active December 17, 2015 07:19 — forked from oz/clock.sh
#!/bin/sh
time_here=`date`
#COL=$(tput cols)
COL=60
AWESOME_TZ="UTC America/Los_Angeles America/Mexico_City America/New_York Europe/Paris Europe/Berlin Asia/Tokyo"
echo 'Awesome world clock:'
echo
@spk
spk / reindex.rake
Last active December 15, 2015 10:19
Regenerate all ES indexes
# encoding: UTF-8
namespace :indexes do
desc "Regenerate all ES indexes"
task :regenerate => [:environment] do
Rails.application.eager_load!
ActiveRecord::Base.descendants.each do |model|
if model.respond_to?(:tire)
puts "* (Re)generating indexes for model #{model.name}"
sh "bundle exec rake environment tire:import CLASS='#{model.name}'"
#!/usr/bin/env sh
#$ extract_cookies $HOME/.mozilla/firefox/*/cookies.sqlite > /tmp/cookies.txt
#$ wget --load-cookies=/tmp/cookies.txt http://mysite.com
#$ # OR
#$ curl --cookie /tmp/cookies.txt http://mysite.com
cleanup() {
rm -f $TMPFILE
exit 1
}
@spk
spk / populate.rake
Created March 14, 2012 13:39
Populate tasks template
# encoding: utf-8
namespace :db do
I18n.locale = :en
desc "initialize"
task :init => [:environment] do
raise "\n Please run `rake db:seed` before" if User.all.blank?
require 'ffaker'