Skip to content

Instantly share code, notes, and snippets.

View beshur's full-sized avatar

Alex Buznik beshur

View GitHub Profile
@beshur
beshur / scripts.js
Created November 30, 2012 10:31
jQuery dummy
/* Bankoscopo JS */
var page_var = {
w_w: $(window).width(),
w_h: $(window).height(),
s_t: $("html, body").scrollTop()
}
$(function() {

Взаимодействие компонент

Грамотная архитектура веб-приложения важна не только для продакшен-версий, но и для долгоживущих прототипов. Итеративные изменения возможны лишь в условиях, котогда сложность проведения последующей итерации не растет экспоненциально.

Ниже пойдет речь о четырех наиболее рациональных способах организации взаимодействия компонентов интерфейса в Beast.

1. Через отношение блок-элемент

Методолгия БЭМ предлагает самый удобный и простой способ провязывания компонентов — когда одни (элементы) подчиняются другим (блокам). Принято считать, что все связи в ирерахических структурах должны быть направлены от родителя к ребенку, а ребенок не должен ничего знать о контексте своего использования. Однако, основываясь на том, что элементы не могут существовать без своего родительского блока, это правило можно и нужно нарушать, но только при связывании блока и элемента.

/*
* Блок тумбнеила
* Ширина задается числом колонок сетки (добавлением классов grid_col_1, grid_col_2...)
* Высота вычисляется согласно пропорции (_ratio), в процентах от ширины
*/
.thumb
display inline-block
background center center no-repeat
background-size cover
@cultofmetatron
cultofmetatron / gist:5349630
Created April 9, 2013 21:38
passport ajax capable authenticate
app.post('/login', function(req, res) {
console.log(res);
passport.authenticate('local', function(err, user) {
if (req.xhr) {
//thanks @jkevinburton
if (err) { return res.json({ error: err.message }); }
if (!user) { return res.json({error : "Invalid Login"}); }
req.login(user, {}, function(err) {
if (err) { return res.json({error:err}); }
return res.json(
@spruce
spruce / .hubotrc
Last active March 23, 2021 21:06 — forked from febuiles/hubot.sh
Scripts to start automatically start hubot on startup on debian
#!/bin/bash
export PORT=5555 # setting port for hubot scripts, only needed if port 8080 is not ok with you
export BIND_ADDRESS=127.0.0.1 # So that hubot is not public under port but can be proxied through e.g. nginx
export HUBOT_HIPCHAT_JID="YOUR_ID_HERE@chat.hipchat.com" # set HipChatid
export HUBOT_HIPCHAT_PASSWORD="YOUR_PASSWORD_HERE" # setting password for HipChat
export GITLAB_CHANNEL="CHANNEL@conf.hipchat.com" # channel to which to send the GITLAB messages
@briangonzalez
briangonzalez / README.md
Created October 21, 2012 04:25
img2boxshadow - a ruby script to convert images to CSS [http://codepen.io/briangonzalez/details/AvrGI#pen-details-tab]

img2boxshadow.rb

a ruby script to convert images to CSS (box-shadows)

Installation

gem install rmagick    # you'll need ImageMagick & Ruby first
gem install colormath
gem install micro-optparse
@gabrielhpugliese
gabrielhpugliese / meteor-windows-vagrant-tutorial.md
Last active April 19, 2022 14:37
Tutorial for running Meteor in Windows using Vagrant

Tutorial: Meteor in Windows using Vagrant

BEFORE YOU CONTINUE:

  • Now, Meteor runs in any Windows without any line of this tutorial. Just download the Meteor binary! Yay!!
  • mrt is no longer used with Meteor 1.0

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

@Hexodus
Hexodus / count_total_project_code_lines_in_sublime
Created September 8, 2013 17:06
Count total code lines in project using Sublime texteditor
// Go to menue:
// find->find in files
// Switch on reg_ex button
// Find:
^(.*)$
// Where:
c:\your_folder\,*.php,*.phtml,*.js,*.inc,*.html, -*/folder_to_exclude/*
// Then click on the find button
// Be careful to not click on Replace!!!
:;while [ $? -eq 0 ];do nc -vlp 8080 -c'(r=read;e=echo;$r a b c;z=$r;while [ ${#z} -gt 2 ];do $r z;done;f=`$e $b|sed 's/[^a-z0-9_.-]//gi'`;h="HTTP/1.0";o="$h 200 OK\r\n";c="Content";if [ -z "$f" ];then ($e $o;(for n in *;do if [ -f "$n" ]; then $e "<a href=\"/$n\">`ls -gh \"$n\"`</a><br>";fi;done););elif [ -f "$f" ];then $e "$o$c-Type: `file -ib \"$f\"`\n$c-Length: `stat -c%s \"$f\"`";$e;$e $f>&2;cat "$f";else $e -e "$h 404 Not Found\n\n404\n";fi)';done
@tobitailor
tobitailor / get_barcode_from_image.js
Created June 1, 2010 19:33
Barcode recognition with JavaScript - Demo: http://bit.ly/djvUoy
/*
* Copyright (c) 2010 Tobias Schneider
* This script is freely distributable under the terms of the MIT license.
*/
(function(){
var UPC_SET = {
"3211": '0',
"2221": '1',
"2122": '2',