Skip to content

Instantly share code, notes, and snippets.

Avatar

Adrienne L. Travis adrienne

View GitHub Profile
@mildlygeeky
mildlygeeky / gist:14b814ec8c815a1f5c6f
Last active Jan 3, 2019
Dynamic Navigation using native Craft CMS and Twig templates
View gist:14b814ec8c815a1f5c6f
{# For this, I wanted the nav to show the top-level node and second-level nodes #}
{# when on level 1, and then show the second-level and its children when on #}
{# level 2 or level 3 (so we get good parent, child, and sibling navigation. #}
{# Requires string 'sectionName' to be passed with Structure section name #}
{% if entry.showLeftNavigation %}
<nav class="interior-page__nav">
@tylerwillingham
tylerwillingham / readme.md
Last active Sep 14, 2016
PuPHPet: Craft CMS VM
View readme.md

PuPHPet for Craft Development

I wanted to get a VM configured quickly for building Craft sites, this is what I did:

https://puphpet.com/#deploy-target

Deploy Target: Local VM

I want a local VM working with Vagrant + VirtualBox.

Local VM Details

@jsomers
jsomers / android-websters.md
Last active Dec 13, 2019
Instructions for using Webster's 1913 on Android
View android-websters.md

To use Webster's 1913 dictionary on Android, install Colordict 3, an app that accepts this StarDict format. https://play.google.com/store/apps/details?id=com.socialnmobile.colordict

Next download James's S3 archive. https://s3.amazonaws.com/jsomers/dictionary.zip

You will need to extract the .dict file from inside three containers - .dz, .tar, .bz2 from innermost to outermost. 7zip handles all of these formats.

Place the .dict, .idx and .ifo files in the dictdata directory on your sdcard or local storage root. This is where colordict looks for dictionaries.

When the files are in the right place, you can run Colordict and tap the folder icon in the top right to see the dictionaries installed and set the dictionary priority. I put the 1913 dictionary above the defaults "Wordnet" and "Wikipedia." When you look up a word, ColorDict shows the definition, if available, from these multiple sources.

@croxton
croxton / cpanel_vps_eecms_config.md
Last active Aug 29, 2018
Battle-tested cPanel VPS server configuration for medium traffic ExpressionEngine websites
View cpanel_vps_eecms_config.md

"Medium traffic" = able to handle around 50 concurrent users on average.

If you want to handle 100+ concurrent users with the same modest hardware see the Varnish section below.

VPS

  • 4096 MB memory
  • 125GB SSD
  • 4 CPUs
  • Cpanel
View hhvm-async-test.php
<?hh
async function stream_check(resource $stream, string $mode, int $usec): Awaitable<void>
{
$r = $w = $e = null;
do {
if ($mode == "r") {
$r = Vector{$stream};
}
@brandonkelly
brandonkelly / templating.md
Last active Aug 6, 2020
Templating in EE vs. Craft
View templating.md
View gist:8062739
$.fn.markerList = function(options) {
var titles = {};
var geocoder = new google.maps.Geocoder();
var _default = {
map: {},
bounds: new google.maps.LatLngBounds(),
lat: false,
lng: false,
@0xabad1dea
0xabad1dea / weird-machines-video-games.md
Last active Aug 29, 2019
Weird Machines in Video Games
View weird-machines-video-games.md

Abadidea's Index of Weird Machines in Video Games

A "weird machine" is when user-supplied input is able to create an arbitrary new program running within an existing program due to Turing-completeness being exposed. Sometimes such functionality was deliberately included but it is often the result of exploitation of memory corruption. You can learn more at the langsec site. There is a good argument for weird machines being inherently dangerous, but this index is just for fun.

It is broken into two categories: intentional gameplay features which may be used as weird machines, and exploit-based machines which can be triggered by ordinary player input (tool-assisted for speed and precision is acceptable). Games with the sole purpose of programming (such as Core Wars) are not eligible and plugin APIs don't count. If you know of more, feel free to add a comment to this gist.

Intentional Gameplay Mechanics

@mikeal
mikeal / gist:7724521
Last active Dec 29, 2015
Inclusive by Exclusion
View gist:7724521

When you build a community you're creating a culture. That culture will be about more than the code, the modules, or the language. The people you draw in will have their own biases and behaviors that impact the kinds of people you continue to draw as you grow.

Cultures will naturally fight behavior that is divisive. That is, behavior that is divisive to the established members of that community. As a community grows larger it is harder and harder to change what the culture finds acceptable because changing it, even if it is inclusive in nature, is disturbing and divisive to existing membership. Fighting for change in established cultures means dealing with a lot of dismissive language and attacks for the "tone" of your argument.

That is why it is so important that a culture becomes comfortable with aggressively fighting exclusionary behavior. While it is certainly more beneficial to make pro-active steps to increase diversity we cannot be dismissive of the effect that passionate reactions to poor behavior

@robotlolita
robotlolita / loops-are-evil.md
Last active Jul 6, 2020
Why `xs.each(f)` should not be considered a "loop".
View loops-are-evil.md

First and foremost, let's take a look at the following pieces of code. The first one is something you should be rather familiar with, and the second one is also a somewhat familiar idiom these days (at least in languages with higher-order functions):

// Example 1:
30 + 12

// Example 2:
xs.map(f)
You can’t perform that action at this time.