Skip to content

Instantly share code, notes, and snippets.

View beshur's full-sized avatar

Alex Buznik beshur

View GitHub Profile
@beshur
beshur / .gitignore
Created September 8, 2014 08:44
wordpress .gitignore
# Ignore everything in the root except the "wp-content" directory..
/
/wp-config.php
/local-config.php
/remote-config.php
!.gitignore
!wp-content
wp-includes
wp-admin
wp-snapshots
@beshur
beshur / getNumeral.js
Created August 14, 2014 08:54
javascript Numerate endings Окончания на русском
/**
* original: http://pastebin.com/mnznDg7q
* by @grumblerbear
*
* Пример:
* 1, ['сайт', 'сайта', 'сайтов']
* Результат:
* 'сайт'
*
* Пример:
@beshur
beshur / app.js
Created August 8, 2014 13:46
Javascript Express node-sass config
var express = require('express'),
// ... other packages
sass = require('node-sass');
// ...
var app = express();
// ...
// Commented this default express generator line:
// app.use(require('stylus').middleware(path.join(__dirname, 'public')));
//
@beshur
beshur / route.js
Last active August 21, 2019 04:02 — forked from cultofmetatron/gist:5349630
Javascript Node.js Express Login route with ajax responses
app.post('/login', function(req, res) {
console.log(res);
passport.authenticate('local', function(err, user, params) {
if (req.xhr) {
//thanks @jkevinburton
if (err) { return res.json({ error: err.message }); }
// e.g. in auth.js:
// if (!user.emailVerified) { return done(null, false, { message: 'Email is not verified. Please check your email for the link.' }); }
if (!user && params) { return res.json({error : params.error}); }
<?php
/**
* Define type of server
*
* Depending on the type other stuff can be configured
* Note: Define them all, don't skip one if other is already defined
*/
define( 'DB_CREDENTIALS_PATH', dirname( ABSPATH ) ); // cache it for multiple use
@beshur
beshur / checkboxize.css
Last active August 29, 2015 14:01
jQuery Simple checkbox javascript after styling
.e_checkbox,
.e_radiobox {
position: relative;
display: inline-block;
width: 17px;
height: 17px;
margin-right: 5px;
}
@beshur
beshur / httpd-vhosts.conf
Created May 27, 2014 12:01
temp virtual host for family.beetroot
# Virtual Hosts
#
<VirtualHost *:80>
DocumentRoot "c:\wamp\www\family-beetroot"
ServerName family_br.loc
</VirtualHost>
@beshur
beshur / gist:9951830
Created April 3, 2014 10:00
laravel error tmp
<?php
App::error(function(Exception $exception, $code)
{
Log::error($exception);
// Save data to the database
$getUser = '';
// ....
@beshur
beshur / al.php
Created March 19, 2014 09:57
php Yii attributeLabels example
<?php
class Profile extends CActiveRecord
{
public function attributeLabels()
{
return array(
'id' => Yii::t('model', 118),
'from' => Yii::t('model', 119),
'email' => Yii::t('model', 120),
'user_id' => Yii::t('model', 121),
@beshur
beshur / resize.js
Created February 3, 2014 10:40
javascript jQueryUI Resizable window resize bug fix (jQuery)
// fix jqueryui resizable bug:
//
// jqueryui resizable on 'resize' event invokes
// window.resize event, which maybe unwanted behaviour sometimes
//
window.onresize = function(event) {
if (typeof event.target.getAttribute === 'function')
return;
};