Skip to content

Instantly share code, notes, and snippets.

View mosinski's full-sized avatar
👨‍💻
Shipping Code... Day & Night 🚀

Miłosz Osiński mosinski

👨‍💻
Shipping Code... Day & Night 🚀
View GitHub Profile
@mosinski
mosinski / basic-spree-backend.md
Last active August 29, 2015 14:05
Basic Spree Backend

Set up a Spree backend only install

rails new your-store-name

Gemfile

gem 'spree_backend', github: 'spree/spree'
@mosinski
mosinski / twittershare
Last active August 29, 2015 14:03
custom twitter share button
<a href="http://gpiot.com" title="Expert in Web Design and Online Software Development @guillaumepiot" class="tweet" target="_blank">Tweet this!</a>
<script>
$('a.tweet').click(function(e){
e.preventDefault();
var loc = $(this).attr('href');
var title = escape($(this).attr('title'));
window.open('http://twitter.com/share?url=' + loc + '&text=' + title + '&', 'twitterwindow', 'height=450, width=550, top='+($(window).height()/2 - 225) +', left='+$(window).width()/2 +', toolbar=0, location=0, menubar=0, directories=0, scrollbars=0');
});
</script>
@mosinski
mosinski / fbshare
Created July 6, 2014 23:46
custom fb share button
<a href="javascript:fbShare('http://gdanskcurlingclub.pl/news/21', 'Fb Share', 'Facebook share popup')">Share</a>
<script>
function fbShare(url, title, descr, image, winWidth, winHeight) {
var winTop = (screen.height / 2) - (winHeight / 2);
var winLeft = (screen.width / 2) - (winWidth / 2);
window.open('http://www.facebook.com/sharer.php?s=100&p[title]=' + title + '&p[summary]=' + descr + '&p[url]=' + url + '&p[images][0]=' + image, 'sharer', 'top=' + winTop + ',left=' + winLeft + ',toolbar=0,status=0,width=' + winWidth + ',height=' + winHeight);
}
</script>
@mosinski
mosinski / bug
Last active August 29, 2015 14:03
js code:
$( document ).ready(function() {
function callAjax(){
var xmlhttp, account;
xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function(){
if (xmlhttp.readyState == 4 && xmlhttp.status == 200){
account = document.getElementById("test");
account.innerHTML=xmlhttp.responseText;
document.getElementById('delete_account').getElementsByClassName("modal-footer")[0].getElementsByClassName("btn-danger")[0].click();
#!/usr/bin/env ruby
# encoding: UTF-8
require 'rubygems'
require 'nokogiri'
require 'open-uri'
unless ARGV[0] and ARGV[1]
puts "Niepoprawne użycie skryptu"
puts "Sposób użycia: script.rb <miesiąc> <dzień>"
works tag log:
ActsAsTaggableOn::Tag Load (2.7ms) SELECT "tags".* FROM "tags" INNER JOIN "taggings" ON "tags"."id" = "taggings"."tag_id" WHERE "taggings"."taggable_id" = 1127 AND "taggings"."taggable_type" = 'Candidate' AND (taggings.context = 'trades' AND taggings.tagger_id IS NULL)
ActsAsTaggableOn::Tag Load (1.1ms) SELECT "tags".* FROM "tags" WHERE (lower(name) = '3ds max')
ActsAsTaggableOn::Tag Load (2.5ms) SELECT "tags".* FROM "tags" INNER JOIN "taggings" ON "tags"."id" = "taggings"."tag_id" WHERE "taggings"."taggable_id" = 1127 AND "taggings"."taggable_type" = 'Candidate' AND (taggings.context = 'skills' AND taggings.tagger_id IS NULL)
ActsAsTaggableOn::Tagging Exists (28.4ms) SELECT 1 AS one FROM "taggings" WHERE ("taggings"."tag_id" = 311 AND "taggings"."taggable_type" = 'Candidate' AND "taggings"."taggable_id" = 1127 AND "taggings"."context" = 'skills' AND "taggings"."tagger_id" IS NULL AND "taggings"."tagger_type" IS NULL) LIMIT 1
error tag log:
ActsAsTaggableOn::Tag Load (55.3ms) S
/* ==================================================
AJAX Register Form
================================================== */
jQuery(function($){
$("form#sign_up_user").submit(function(e){
e.preventDefault();
var user_info = $(this).serialize();
$.ajax({
type: "POST",
url: $(this).attr('action'),
@mosinski
mosinski / .vimrc
Last active January 3, 2016 05:39
Istalacja Pathogen:mkdir -p ~/.vim/autoloadmkdir -p ~/.vim/bundlecd ~/.vim/autoload curl -Sso ~/.vim/autoload/pathogen.vim https://raw.github.com/tpope/vim-pathogen/master/autoload/pathogen.vim
" Pathogen *******************************************************************
call pathogen#incubate()
call pathogen#helptags()
" General ********************************************************************
set nocompatible
set encoding=utf-8
set fileencodings=utf-8,latin2
" Autowrite current buffer on switch
[user]
email = mylosz@yahoo.pl
name = Miłosz Osiński
[alias]
br = branch
co = checkout
ci = commit
df = diff
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac