Skip to content

Instantly share code, notes, and snippets.

View beshur's full-sized avatar

Alex Buznik beshur

View GitHub Profile
@beshur
beshur / 0_reuse_code.js
Last active August 29, 2015 14:19
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@beshur
beshur / getTpl.js
Created March 25, 2015 15:18
getTpl - underscore templates shorthand
function getTpl(tpl, options) {
if (!tpl) return;
if (!options) options = null;
var prepare = false;
if (options == 1) {
options = {};
prepare = true;
console.log('prepare');
}
@beshur
beshur / b_skeletons.js
Last active September 10, 2015 14:49
Backbone Collection Bootstrap - Skeleton
/** General Skeletons controller */
var Skeletons = Backbone.View.extend({
model: SkeletonsModel,
el: ".b_skeletons",
events: {
},
@beshur
beshur / socketHelper.js
Created March 10, 2015 11:53
socket helper
var socketHelper = function() {
this.clientId = "";
this.getClientId = function() {
return this.clientId;
}
this.address = "localhost";
@beshur
beshur / deploy.sh
Created February 20, 2015 15:53
Deployment script
#!/bin/sh
cd ..
grunt release
cd build
echo "compressing..."
tar -cf portal.tgz ../* --exclude=../node_modules --exclude=../tests/node_modules --exclude=../data --exclude=../config/local.json
echo "deploying to server"
scp -r portal.tgz root@server:/root/remote-folder/
echo "updating sources"
ssh root@server "
@beshur
beshur / jk-nav.js
Created November 24, 2014 22:17
jQuery wordpress j/k next/prev navigation
// Simple J/k navigation for Wordpress
// by Alex Buznik (@beshur)
//
// Change t value for the correct selectors of the items that need to be traversed
(function($) {
$(function() {
var is_blog = true;
if (!$("body").hasClass("blog")) {
is_blog = false;
}
// 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!!!
@beshur
beshur / hsb.scss
Created November 14, 2014 09:45
Sass: HSB to HSL converter
// Simple HSB to HSL converter by Alexander Futekov (@futekov)
// http://www.sitepoint.com/hsb-colors-with-sass/
//
@function hsb($h-hsb, $s-hsb, $b-hsb, $a: 1) {
@if $b-hsb == 0 {
@return hsla(0, 0, 0, $a)
} @else {
$l-hsl: ($b-hsb/2) * (2 - ($s-hsb/100));
$s-hsl: ($b-hsb * $s-hsb) / if($l-hsl < 50, $l-hsl * 2, 200 - $l-hsl * 2);
@return hsla($h-hsb, $s-hsl, $l-hsl, $a);
@beshur
beshur / key.pgp
Created September 23, 2014 19:02
keybase key
### Keybase proof
I hereby claim:
* I am beshur on github.
* I am shu (https://keybase.io/shu) on keybase.
* I have a public key whose fingerprint is 65F7 5F9A D475 5021 D0A5 16FC 14A2 E7D5 F5A4 8746
To claim this, I am signing this object:
@beshur
beshur / get.js
Created September 20, 2014 13:13
javascript get deep level of object
var data = {a: {b: 1}};
var type = {l1: "a", l2: "b"};
console.log("pos:", data[type.l1][type.l2]);