Skip to content

Instantly share code, notes, and snippets.

View bratsun's full-sized avatar

Max Bratsun bratsun

View GitHub Profile
@bratsun
bratsun / change_wp_pass
Created March 7, 2017 13:52
Change admin password
use wp_genesis;
SELECT ID, user_login, user_pass FROM wp_users;
UPDATE wp_users SET user_pass = MD5('TEST') WHERE ID=1 LIMIT 1;
@bratsun
bratsun / mysql_import
Created March 7, 2017 10:00
Import SQL
mysql -u username -p
use database_name;
SOURCE /path/to/sql/file.sql
show tables;
select * from table;
@bratsun
bratsun / undo_update
Last active February 7, 2017 08:49
update node.js on Ubuntu
sudo apt-get install --reinstall nodejs-legacy # fix /usr/bin/node
sudo n rm 6.0.0 # replace number with version of Node that was installed
sudo npm uninstall -g n
@bratsun
bratsun / simple_arrow.sass
Last active January 4, 2017 16:53
Simple css arrow for next link
.btn-next{
text-transform: uppercase;
font-size: 13px;
position: relative;
margin-top: 25px;
display: inline-block;
&:after {
position: relative;
top: -2px;
@bratsun
bratsun / prefixer.sass
Created October 11, 2016 10:06
Prefixer
@mixin prefix($property, $value, $prefixes: ()) {
@each $prefix in $prefixes {
#{'-' + $prefix + '-' + $property}: $value;
}
// Output standard non-prefixed declaration
#{$property}: $value;
}
@bratsun
bratsun / default_transition.sass
Created October 11, 2016 10:04
Default transition
a,
.trans,
.alert,
.btn,
button,
svg path,
svg polygon{
@include prefix(transition, all 200ms cubic-bezier(0.025, 0.185, 0.000, 0.590), webkit moz ms o);
@include prefix(transition-timing-function, cubic-bezier(0.025, 0.185, 0.000, 0.590), webkit moz ms o);
}
@bratsun
bratsun / linear_gradient.sass
Created October 11, 2016 10:03
Linear gradient mixin
@mixin linear-gradient($direction, $color-stops...) {
// Direction has been omitted and happens to be a color-stop
@if is-direction($direction) == false {
$color-stops: $direction, $color-stops;
$direction: 180deg;
}
background: nth(nth($color-stops, 1), 1);
background: -webkit-linear-gradient($direction, $color-stops);
background: linear-gradient($direction, $color-stops);
}
@bratsun
bratsun / radial_gradient.sass
Created October 11, 2016 10:03
Radial gradient mixin
@mixin radial-gradient($from, $to) {
background: -moz-radial-gradient(center, circle cover, $from 0%, $to 100%);
background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%, $from), color-stop(100%, $to));
background: -webkit-radial-gradient(center, circle cover, $from 0%, $to 100%);
background: -o-radial-gradient(center, circle cover, $from 0%, $to 100%);
background: -ms-radial-gradient(center, circle cover, $from 0%, $to 100%);
background: radial-gradient(center, circle cover, $from 0%, $to 100%);
background-color: $from;
}
// create and save
$entity = Entity::create($values);
$entity = Entity::load($id);
$entities = Entity::loadMultiple($ids);
$entity->save();
$entity->delete();
$entity_id = $entity->id();
$bundle = $entity->bundle();
@bratsun
bratsun / check_options_bundle_type_add_container.twig
Created October 11, 2016 08:36
Check options array, bundle type, and add container class
{% if 'full-width' not in options and bundle != 'fullcta' and bundle != 'home_intro' %}
{% set container = 'container' %}
{% endif %}