Skip to content

Instantly share code, notes, and snippets.

View beshur's full-sized avatar

Alex Buznik beshur

View GitHub Profile
@beshur
beshur / helper.js
Created January 14, 2014 10:56
meteor Handlebars helper
Handlebars.registerHelper("_i18n", function (string, content) {
if (!string) return;
var t = __(string, {message: content});
return t;
});
@beshur
beshur / inputNumberize.js
Created December 13, 2013 14:46
simple jQuery number input imitator
// simple jQuery input[type='number'] imitator
// with callback on number change
//
// supposed markup:
// <div class="elemnt">
// <input type="text" class="target" />
// <span class="arr more"></span>
// <span class="arr less"></span>
// </div>
$.fn.inputNumberize = function(options) {
@beshur
beshur / countdownize.js
Created December 9, 2013 14:05
jQuery Simple minutes countdown timer
// jQuery Simple minutes countdown timer
// https://gist.github.com/beshur/7872704
// @beshur
$.fn.countdownize = function() {
if (typeof window.page_var == "undefined") window.page_var = {};
this.each(function(i) {
var obj = $(this);
// assumes integer seconds are here
@beshur
beshur / blockPosition.js
Last active December 29, 2015 17:39
jQuery blockPosition
// jQuery function to center the image and stretch it to completely fill
// the parent, stretchin either height or width, when needed
//
// originally written by Ivan Ryzhenko
// https://gist.github.com/beshur/7706062
//
// Usage:
// blockPosition($(img_you_need_to_center), $(optional_relative));
function blockPosition(obj, relative){
obj.each(function(index, element) {
@beshur
beshur / scroll.js
Created November 19, 2013 09:46
jQuery check if element is scrolled to (close to Bootstrap affix)
window.page_var = {};
window.onload = function() {
$(".b_screens__el").each(function (i) {
page_var.screens[i] = $(this).offset().top;
})
}
$(window).resize(function() {
$(".b_screens__el").each(function (i) {
page_var.screens[i] = $(this).offset().top;
})
@beshur
beshur / index.html
Last active December 27, 2015 23:19
HTML basic bootstrap
<!DOCTYPE html>
<html>
<head>
<title>index</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style type="text/css">
html, body {

Tutorial: Meteor in Windows using Vagrant

These days some people were discussing at meteor-talk group about running Meteor at Windows and I’ve recommended them using Vagrant. It’s a very developer-friendly piece of software that creates a virtual machine (VM) which let you run any operating system wanted and connect to it without big efforts of configuration (just make the initial installation and you have it working).

Many packages (I've tested) for running Meteor+Vagrant fails because Meteor writes its mongodb file and also other files inside local build folder into a shared folder between the Windows host and the Linux guest, and it simply does not work. So I've put my brain to work and found a solution: do symlinks inside the VM (but do not use ln. Use mount so git can follow it). It’s covered on steps 8 to 15.

If you have no idea what I’m talking about, I’ve made a tutorial to install Ubuntu Precise x86 through Windows command-line with Meteor very simple to follow

jQuery Caret

This is a very simple lightweight plugin to allow you to move the caret (or cursor) position in an <input /> or <textarea> element.

By exposing three jQuery.fn methods you can easily move a a caret to any position you like:

$.fn.caretTo( index , [ offset ] )

@beshur
beshur / b_select.css
Last active December 15, 2015 19:18
jQuery styled select js
.b_select {
position: relative;
display: block;
margin-top: 1px;
margin-right: 29px;
padding: 0;
color: #000;
font-size: 12px;
ABACAS => #ABACA5
ABASED => #ABA5ED
ABASES => #ABA5E5
ABBESS => #ABBE55
ABODED => #AB0DED
ABODES => #AB0DE5
ACCEDE => #ACCEDE
ACCESS => #ACCE55
ADOBES => #AD0BE5
ADOBOS => #AD0B05