Skip to content

Instantly share code, notes, and snippets.

View tobob's full-sized avatar
😼
wanna something?

Wojciech Bożek tobob

😼
wanna something?
View GitHub Profile
@tobob
tobob / description
Last active September 29, 2017 08:51
My unicorn and nginx configuration
My unicorn and nginx configuration
use ln -s and place new_app in 'sites-enabled' folder
usefull commands:
lsof -wni tcp:8080 - get PID of all unicorn processes
kill -9 PID - kill process
nginx -s reload - reload nginx
unicorn_rails -c /home/workspace/new_app/config/unicorn.rb -D - starts unicorn server
@tobob
tobob / product_filters.rb
Last active December 27, 2015 05:18
Spree filter by many properties (require squeel gem)
# encoding: utf-8
module Spree
module Core
module ProductFilters
if Spree::Property.table_exists?
Spree::Product.add_search_scope :color_filer do |*opts|
@tobob
tobob / testing.js.coffee
Created May 22, 2014 14:35
Handlebars to testing strings
Ember.Handlebars.registerBoundHelper 'testing-helper', (el0)->
new Handlebars.SafeString("<b>Debug Handlebar! 0 args</b> #{el0}")
Ember.Handlebars.registerBoundHelper 'testing-helper-1', (el0)->
new Handlebars.SafeString("<b>Debug Handlebar! 1 arg</b> #{el0}")
Ember.Handlebars.registerBoundHelper 'testing-helper-2', (el0, el1)->
new Handlebars.SafeString("<b>Debug Handlebar! 2 args</b> #{el0} #{el1}")
@tobob
tobob / nginx.conf
Created August 11, 2014 23:34
default nginx configuration
user www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
ok = false
while(!ok)
users_list_ids = User.all.pluck(:id).shuffle
User.all.each_with_index do |user, index|
user.update_attribute(:target_id, users_list_ids[index])
end
ania_ok = User.find_by(name: 'Ania').target.name != 'Damian'
import React, {
createContext,
useState,
useEffect,
useRef,
useCallback,
} from 'react';
const initialToast = {
message: '',
import React, {useContext, useEffect, useRef} from 'react';
import {ToastContext} from './ToastContext';
import {
Text,
Animated,
Easing,
TouchableOpacity,
StyleSheet,
} from 'react-native';
const styles = StyleSheet.create({
toast: {
borderRadius: 4,
marginHorizontal: 16,
padding: 4,
position: 'absolute',
top: 0,
zIndex: 2,
right: 0,
left: 0,
useEffect(() => {
if (toast.visible) {
timeout.current = setTimeout(hide, 1500);
return () => {
if (timeout.current) {
clearTimeout(timeout.current);
}
};
}
}, [hide, toast]);
useEffect(() => {
if (toast.visible) {
timeout.current = setTimeout(hide, 1500);
return () => {
if (timeout.current) {
clearTimeout(timeout.current);
}
};
}
}, [hide, toast]);