Skip to content

Instantly share code, notes, and snippets.

// ==UserScript==
// @name X mute the muted
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://twitter.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=x.com
// @grant none
// @require file:///Users/viktor/Developer/JavaScript/tampermonkey/xMuteTheMuted.js
! name: APIdock downranker
! description: Lowers the rank of APIdock results
! public: true
! author: vfonic
! homepage: https://gist.github.com/vfonic/62a4d8d3625abd1067521d1b7c0ff8f7
! issues: https://gist.github.com/vfonic/62a4d8d3625abd1067521d1b7c0ff8f7
$discard,site=apidock.com
# db/migrate/add_signature_fields_to_delayed_jobs.rb
class AddFieldsToDelayedJobs < ActiveRecord::Migration
def change
add_column :delayed_jobs, :signature, :string
add_index :delayed_jobs, :signature
end
end
def save
ActiveRecord::Base.transaction do
user = User.save(username: username) # user doesn't have to be instance var @user
add_errors(user.errors) unless user.persisted?
tweet = Tweet.save(body: first_tweet, user_id: user.id)
add_errors(tweet.errors) unless tweet.persisted?
user.persisted? && tweet.persisted?
end
end
@vfonic
vfonic / lazyimages.jsx
Last active September 13, 2018 12:18 — forked from saigowthamr/lazyimages
import React from 'react';
import moment from 'moment';
import LazyLoad from 'react-lazyload';
import './albums.css'
export default (props)=>{
function formatDate(date, format){
return moment(date).format(format);
@vfonic
vfonic / uninstall_rails_version.sh
Created July 13, 2017 06:37
Script for uninstalling all rails gem dependencies for the given rails version
#!/bin/bash -e
gem uninstall railties rails actionmailer actioncable actionpack actionview activerecord activejob activemodel activesupport -v $1

Environment

Bundler   1.15.0
Rubygems  2.6.10
Ruby      2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin16]
GEM_HOME  /Users/viktorfonic/.rvm/gems/ruby-2.4.0
GEM_PATH  /Users/viktorfonic/.rvm/gems/ruby-2.4.0:/Users/viktorfonic/.rvm/gems/ruby-2.4.0@global
RVM       1.29.1 (latest)
Git       2.13.0
#!/bin/bash -e
function externalize_git {
if [ ! -d "$git_repos_repo_full_path" ]; then
mkdir -p "$git_repos_repo_full_path"
mv .git "${git_repos_repo_full_path}"/.git
git --git-dir="${git_repos_repo_full_path}/.git" --work-tree=. init && echo "gitdir: ${git_repos_repo_full_path}/.git" > .git
else
echo "Directory $git_repos_repo_full_path already exists!"
fi