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 / 01_sanitize.rb
Last active August 29, 2015 14:15
Sanitize issue
require 'sanitize'
raw_markup = File.read('markup.html')
class Sanitize
module Config
# Very restrictive config for wikipedia markup sanitizer
WIKIPEDIA = freeze_config(
elements: %w[b em i strong u br ol ul li pre p h1 h2 h3 h4 h5 h6],
remove_contents: %w[sup table],
# Transformers section
diff --git a/wp-content/plugins/Tevolution-Events/templates/mobile-single-event.php b/wp-content/plugins/Tevolution-Events/templates/mobile-single-event.php
index f3116a6..ce12e7f 100644
--- a/wp-content/plugins/Tevolution-Events/templates/mobile-single-event.php
+++ b/wp-content/plugins/Tevolution-Events/templates/mobile-single-event.php
@@ -36,7 +36,7 @@ if(function_exists('bdw_get_images_plugin'))
<?php
if(function_exists('supreme_sidebar_before_content'))
- apply_filters('tmpl_before-content',supreme_sidebar_before_content() ); /* Loads the sidebar-before-content.?>*/
+ apply_filters('tmpl_before-content',supreme_sidebar_before_content() ); /* Loads the sidebar-before-content.*/ ?>
Category 1 (id: 1, position: 1, depth: 0, ancestry: )
├── Category 2 (id: 2, position: 1, depth: 1, ancestry: 1)
│ ├── Category 3 (id: 3, position: 1, depth: 2, ancestry: 1/2)
│ └── Category 4 (id: 4, position: 2, depth: 2, ancestry: 1/2)
└── Category 5 (id: 5, position: 2, depth: 1, ancestry: 1)
├── Category 6 (id: 6, position: 1, depth: 2, ancestry: 1/5)
└── Category 7 (id: 7, position: 2, depth: 2, ancestry: 1/5)
"Saving category 5 with the following changes: "
{
"ancestry" => [
@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));