Skip to content

Instantly share code, notes, and snippets.

@Boorj
Boorj / gist:6437875c573df38c49e5
Created November 5, 2015 10:00
dump of my paths from bolt.app
root = ".
rootpath => C:/...root_path...
apppath => C:/...root_path.../vendor/bolt/bolt/app
extensionsconfig => C:/...root_path.../src/Site/Resources/config/extensions
extensionsconfigpath => C:/...root_path.../src/Site/Resources/config/extensions
extensionspath => C:/...root_path.../app/extensions
filespath => C:/...root_path.../web/files
web => C:/...root_path.../web
webpath => C:/...root_path.../web
cache => C:/...root_path.../app/vars/cache
@Boorj
Boorj / bolt yellow theme.css
Created November 9, 2015 00:04
Bolt backend customization
body, #navpage-content {
background-color: #f9f9f7;
}
.navbar-bolt {
background-color: #f9b304;
box-shadow: none !important;
background-image: none !important;
}
@Boorj
Boorj / convert_select.php
Last active December 12, 2015 08:47
Convert select fields in bolt's contenttype
<?
/**
* ### convert_select
* Sometimes you set values as ['foo', 'bar'] and bolt stores them as strings in db.
* It works ok, if you set values as ['':'', 0: 'foo', 1: bar] in contenttypes.yml.
* I wanted to update my old values, so i created a util function. Here it is, use however you want.
*
* @param Application $app
* @param string $contenttype_slug
* @param array $allowed_fields - select fields that should be processed (for ex. ['vendors', 'models']).<br>
@Boorj
Boorj / gist:59e84750736343af91f3
Created December 24, 2015 10:36 — forked from jcsrb/gist:1081548
get avatar from google profiles, facebook, gravatar, twitter, tumblr
function get_avatar_from_service(service, userid, size) {
// this return the url that redirects to the according user image/avatar/profile picture
// implemented services: google profiles, facebook, gravatar, twitter, tumblr, default fallback
// for google use get_avatar_from_service('google', profile-name or user-id , size-in-px )
// for facebook use get_avatar_from_service('facebook', vanity url or user-id , size-in-px or size-as-word )
// for gravatar use get_avatar_from_service('gravatar', md5 hash email@adress, size-in-px )
// for twitter use get_avatar_from_service('twitter', username, size-in-px or size-as-word )
// for tumblr use get_avatar_from_service('tumblr', blog-url, size-in-px )
// everything else will go to the fallback
// google and gravatar scale the avatar to any site, others will guided to the next best version
@Boorj
Boorj / trello_version1.js
Last active March 13, 2016 12:23
Trello switcher bookmarklet v1+2 (doubleclick on top bar)
// Add to toolbar here : http://mrcoles.com/bookmarklet/
// Version 1 (older)
// non-transparent lists
setTimeout(function () {
$(function () {
var $style = $('#klaus-style');
$('#header').off('dblclick.klaus').on('dblclick.klaus', function () {
console.log('switching mode');
$('html').toggleClass('_compact');
@Boorj
Boorj / typo1.js
Last active March 20, 2016 04:02
Cyrillic Typography regexp 1
pattern = /(\s+)([живобаксуяАВИКОСУЯ0-9])(\s)+([а-яА-Я0-9])/g
// to $1$2&nbsp;$4
@Boorj
Boorj / typo2.js
Last active March 20, 2016 04:00
dash typography
pattern = /([а-яА-Яa-zA-Z,])([ \t]+)([-|—])([ \t]+)([а-яА-Яa-zA-Z])/
// to $1&nbsp;—$4$5
@Boorj
Boorj / editor.html
Created September 13, 2016 11:55 — forked from pabluk/editor.html
Markdown Editor
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Markdown Editor</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
@Boorj
Boorj / textarea_auto_resize.js
Created October 17, 2016 05:04
Assigns auto height fitting for any <textarea/> on page
//requires _.throttle and jquery, but dependency could be removed
(function() {
var AutoGrowTextArea;
AutoGrowTextArea = function(e) {
var textField;
textField = e.target;
if (textField.clientHeight < textField.scrollHeight) {
textField.style.height = textField.scrollHeight + 'px';
if (textField.clientHeight < textField.scrollHeight) {
textField.style.height = textField.scrollHeight * 2 - textField.clientHeight + 'px';
@Boorj
Boorj / actions.js
Created October 26, 2016 07:24 — forked from ccorcos/actions.js
export function makePayment(loanId, amount, paymentMethodId) {
return dispatch => {
dispatch(makePaymentSent())
fetch(`/api/loans/${loanId}/payments`, {
headers: new Headers({
'Content-Type': 'application/json',
}),
credentials: 'same-origin',
method: 'POST',
body: JSON.stringify({