Skip to content

Instantly share code, notes, and snippets.

@fabn
fabn / hooksUsage.tsx
Last active July 29, 2021 11:25
Pagination with Reactfire and firebase
import { PAGE_SIZES, usePaginatedCollection } from "./paginationState";
import firebase from "firebase/app";
export type FirestoreUser = {
email: string;
address: string;
zip: string;
city: string;
name: string;
}
@fabn
fabn / cloud-config.yml
Last active July 22, 2019 19:53
My Public key
#cloud-config
rancher:
network:
# interfaces:
# eth1:
# address: 172.68.1.100/24
# gateway: 172.68.1.1
# mtu: 1500
# dhcp: false
dns:
@fabn
fabn / ajax_select.js.coffee
Created October 13, 2015 09:24
ActiveAdmin completion inputs for huge associations
# Vendored javascript files
#= require select2
# Configure defaults for all select2 inputs
$.fn.select2.defaults.set 'theme', 'classic'
$.fn.select2.defaults.set 'placeholder', 'Type to search'
# document ready function
jQuery ->
@fabn
fabn / migrate-repositories.sh
Created June 6, 2013 10:48
I've used this script to synchronize two gitolite installation after permissions has been set in the new repository. Needs password less ssh or ssh agent to work. Can be executed multiple times.
#!/bin/sh
[ $DEBUG ] && set -x
WORKDIR=/tmp/repos
OLD_HOST=git.example.org
OLD_USER=gitolite
NEW_HOST=git.example.com
NEW_USER=gitolite
REPOS='comma,separated,list,of,repositories'
@fabn
fabn / Gemfile
Created May 22, 2013 16:07
Bundler error
source 'https://rubygems.org'
gem 'berkshelf', '~> 1.4.0'
gem 'chef', '~> 10.26.0'
# gem 'json', '~> 1.7.7' # if I uncomment this everything works
gem 'knife-solo', '~> 0.3.0.pre3'
gem 'capistrano'
gem 'capistrano_colors'
gem 'capistrano-notify'
@fabn
fabn / Gemfile
Created February 9, 2013 00:36
This is related to Rubymine issue [RUBY-12044](http://youtrack.jetbrains.com/issue/RUBY-12044)
source 'http://rubygems.org'
gem 'rails', '3.1.10'
gem 'mysql2'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.1.0'
@fabn
fabn / webthumb.php
Created January 10, 2012 13:58
How to retrieve a previously submitted job
<?php
try {
$webthumb = new Bluga_Webthumb();
$webthumb->setApiKey($APIKEY);
$job = $webthumb->addUrl($url,'medium2', 1024, 768);
$job->options->notify = "Your notify url";
$webthumb->submitRequests();
// save the job to retrieve it later
file_put_contents('/tmp/thumbjob.txt', serialize($job));
@fabn
fabn / ErrorController.php
Created January 8, 2012 22:15
Standard Zend Framework ErrorController
<?php
class ErrorController extends Zend_Controller_Action
{
public function errorAction()
{
$logError = true;
$errors = $this->_getParam('error_handler');
@fabn
fabn / qr-demo.rb
Created June 27, 2011 21:30
Segmentation Fault in QRCode#save_png
#!/usr/bin/env ruby
require 'qrencoder'
result = "/tmp/qr.png"
qrcode = QREncoder.encode("a" * 2939)
qrcode.save_png result
@fabn
fabn / passenger_standalone.rb
Created May 31, 2011 19:07 — forked from reu/passenger_standalone.rb
Capistrano recipe for passenger standalone
set :rails_env, "production"
set :passenger_port, 9292
set :passenger_cmd, "#{bundle_cmd} exec passenger"
namespace :deploy do
task :start, :roles => :app, :except => { :no_release => true } do
run "cd #{current_path} && #{passenger_cmd} start -e #{rails_env} -p #{passenger_port} -d"
end
task :stop, :roles => :app, :except => { :no_release => true } do