Skip to content

Instantly share code, notes, and snippets.

View bobdenotter's full-sized avatar
🛠️
"Design is how it works, not how it looks."

Bob den Otter bobdenotter

🛠️
"Design is how it works, not how it looks."
  • Two Kings
  • The Hague, Netherlands
View GitHub Profile
@zomars
zomars / boltflow-bitbucket-deploy.php
Last active April 7, 2017 16:53
Script to deploy from bitbucket via webhook and bobdenotter's Boltflow script (https://github.com/bobdenotter/boltflow)
<?php
$repo_dir = '/home/username';
$branch_to_deploy = 'master';
$update = false;
// Parse data from Bitbucket hook payload
$payload = json_decode($_POST['payload']);
if (empty($payload->commits)) {
@freekrai
freekrai / demo.php
Last active April 21, 2024 00:42
PHP session-based rate limiter for APIs
<?php
date_default_timezone_set('America/Los_Angeles');
session_start();
include("ratelimiter.php");
// in this sample, we are using the originating IP, but you can modify to use API keys, or tokens or what-have-you.
$rateLimiter = new RateLimiter($_SERVER["REMOTE_ADDR"]);
$limit = 100; // number of connections to limit user to per $minutes
$minutes = 1; // number of $minutes to check for.
var CKEDITORPluginExtras = false;
if (typeof(CKEDITOR) != 'undefined' ) {
CKEDITOR.on('instanceReady',function(event, instance){
if (CKEDITORPluginExtras) {
return;
}
var config = event.editor.config;
CKEDITOR.instances.body.destroy();
@silentworks
silentworks / _sub_menu.twig
Last active December 24, 2016 19:01
Getting menu to stay active for sub sections
{% macro display_menu_item(item, loop) %}
{% from _self import display_menu_item %}
{% set menuPath = item.link[1:] != '' ? '/' ~ item.link[1:] ~ '/' : 'home' %}
<li class="main-nav-item index-{{ loop.index }}{% if loop.first %} first{% endif %}{% if loop.last %} last{% endif %}{% if item.submenu is defined %} has-dropdown{% endif %}{% if item|current or menuPath in paths.current %} active{% endif %}">
<a href="{{ item.link }}" {% if item.title is defined %}title='{{ item.title|escape }}'{% endif %}
class='{% if item.class is defined %}{{item.class}}{% endif %}'>
{{item.label}}
</a>
{% if item.submenu is defined %}
<ul class="dropdown">
@bobdenotter
bobdenotter / gist:66fef18def60a25c320f
Created March 24, 2015 19:43
Sublime markdown specifix settings.
{
"color_scheme": "Packages/Theme - Afterglow/Afterglow-markdown.tmTheme",
"extensions":
[
"md"
],
"rulers":
[
70,
80,
@dwolfhub
dwolfhub / index.php
Last active August 29, 2015 14:13
Bolt index.php with environment config support
<?php
require_once "../vendor/autoload.php";
$configuration = new Bolt\Configuration\Composer(dirname(__DIR__));
$configuration->setPath("web", "public_html");
$configuration->setPath("files", "public_html/files");
$configuration->setPath("themebase", "public_html/theme");
$applicationEnv = getenv('APPLICATION_ENV');
if ($applicationEnv and is_dir('app/config/' . $applicationEnv)) {
@bobdenotter
bobdenotter / Preferences.sublime-settings
Last active December 26, 2015 01:29
Sublime settings
{
"always_show_minimap_viewport": false,
"bold_folder_labels": true,
"theme": "Afterglow.sublime-theme",
"color_scheme": "Packages/Theme - Afterglow/Afterglow.tmTheme",
"font_face": "Menlo",
"font_size": 14,
"highlight_line": true,
"highlight_modified_tabs": true,
"ignored_packages":