Skip to content

Instantly share code, notes, and snippets.

View silentworks's full-sized avatar

Andrew Smith silentworks

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mzabriskie
mzabriskie / random-attendee.js
Last active March 6, 2021 16:13
Select random Meetup attendee
// Run this from your browser console on your meetup event page (http://www.meetup.com/AngularJS-Utah/events/183104032/)
(function () {
// Query document for attendees and select a random one
const list = document.querySelector('ul.attendees-list').children,
item = list[Math.floor(Math.random() * list.length)],
name = item ? item.querySelector('h4.text--bold').innerText : 'N/A';
// Remove item so they can only be selected once
item && item.parentNode.removeChild(item);
// Smooth scrolling anchor links
function ea_scroll( hash ) {
var target = $( hash );
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
var top_offset = 0;
if ( $('.site-header').css('position') == 'fixed' ) {
top_offset = $('.site-header').height();
}
if( $('body').hasClass('admin-bar') ) {
@rossriley
rossriley / boltS3.php
Last active July 9, 2019 13:34
Adding an S3 filesystem for Bolt
<?php
use Aws\S3\S3Client;
use League\Flysystem\Filesystem;
use League\Flysystem\Adapter\AwsS3 as Adapter;
$client = S3Client::factory(array(
'key' => '[your key]',
'secret' => '[your secret]',
'region' => '[aws-region]'
));
@ziadoz
ziadoz / Vagrantfile
Last active March 22, 2017 08:58
Example Vagrant File With NFS Synched Folder
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Box.
config.vm.box = "trusty64"
config.vm.network :private_network, ip: "192.168.33.100"
@ziadoz
ziadoz / quantity.html
Created February 25, 2015 02:16
React JS - Product Quantity Input
<!-- Demo: http://jsfiddle.net/o38gdsfd/6/ -->
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>React JS - Quantity Input</title>
<style>
.component-quantity-input {
display: block;
}
@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">
@harikt
harikt / Common.php
Created August 17, 2015 06:54
Configuring Doctrine ORM Entity Manager with Aura.Di
<?php
$di->set('entity_manager', function () {
// paths
$paths = array(__DIR__);
$isDevMode = false;
// the connection configuration
$dbParams = array(
'driver' => 'pdo_mysql',
'user' => getenv('username'),
'password' => getenv('password'),
@jeremykendall
jeremykendall / DoctrineConfig.php
Last active August 29, 2015 14:27
Doctrine2 EntityManager via Aura.Di using wrapper and factory
<?php
namespace Namespace\Di;
use Aura\Di\Config;
use Aura\Di\Container;
use Doctrine\Common\Cache\ApcCache;
use Doctrine\Common\Cache\ArrayCache;
use Doctrine\DBAL\Event\Listeners\MysqlSessionInit;
use Doctrine\ORM\Configuration;
@chadrien
chadrien / README.md
Last active August 24, 2025 21:28
Debug PHP in Docker with PHPStorm and Xdebug

Debug your PHP in Docker with Intellij/PHPStorm and Xdebug

  1. For your local dev, create a Dockerfile that is based on your production image and simply install xdebug into it. Exemple:
FROM php:5

RUN yes | pecl install xdebug \
&amp;&amp; echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" &gt; /usr/local/etc/php/conf.d/xdebug.ini \