Skip to content

Instantly share code, notes, and snippets.

View joelstein's full-sized avatar

Joel Stein joelstein

View GitHub Profile
@joelstein
joelstein / README.md
Created July 31, 2023 17:19 — forked from nichtich/README.md
How to automatically deploy from GitHub

Deploy your site with git

This gist assumes:

  • you have an online remote repository (github / bitbucket etc.)
  • you have a local git repo
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by Apache
  • the Apache user is named www-data (may be apache on other systems)
@joelstein
joelstein / bootstrap-modal.js
Last active November 20, 2017 22:04
AngularJS Bootstrap 4 Modal Service
(function(angular) {
// Define module.
var module = angular.module('bootstrapModal', []);
// Define service.
module.service('$bootstrapModal', ['$q', '$templateRequest', '$rootScope', '$compile', '$controller', function($q, $templateRequest, $rootScope, $compile, $controller) {
var self = this, $element, opened, closed;
@joelstein
joelstein / gist:135a5de77cb8de0626ac685dd6521d56
Last active June 15, 2016 20:19
Angular directive to blur field on enter
angular.module('enterBlur', [])
// Blurs element when enter is pressed.
.directive('enterBlur', function($timeout) {
return {
restrict: 'A',
link: function(scope, element, attrs) {
$timeout(function() {
Drupal.attachBehaviors(element);
});
@joelstein
joelstein / gist:e2528d32747c7f5b8ce5
Last active March 31, 2017 20:40
Apache and logrotate
# First do this, then choose from one of the options below.
sudo nano /etc/logrotate.d/apache2
# Apache 2.4, Ubuntu 14.04.2 LTS
/var/www/*/log/*.log {
weekly
missingok
rotate 52
@joelstein
joelstein / ResponsiveChecklist.md
Last active December 2, 2015 16:03
Checklist for converting existing design to responsive
@joelstein
joelstein / Entrust.net_Secure_Server_CA.pem
Last active August 29, 2015 14:16
/etc/ssl/certs/Entrust.net_Secure_Server_CA.pem / ed524cf5.0
-----BEGIN CERTIFICATE-----
MIIE2DCCBEGgAwIBAgIEN0rSQzANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMC
VVMxFDASBgNVBAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5u
ZXQvQ1BTIGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMc
KGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDE6MDgGA1UEAxMxRW50cnVzdC5u
ZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05OTA1
MjUxNjA5NDBaFw0xOTA1MjUxNjM5NDBaMIHDMQswCQYDVQQGEwJVUzEUMBIGA1UE
ChMLRW50cnVzdC5uZXQxOzA5BgNVBAsTMnd3dy5lbnRydXN0Lm5ldC9DUFMgaW5j
b3JwLiBieSByZWYuIChsaW1pdHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMTk5OSBF
bnRydXN0Lm5ldCBMaW1pdGVkMTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUg
@joelstein
joelstein / gist:f110cb412592582f9d44
Last active August 8, 2017 17:59
Angular Drupal Behaviors directive
angular.module('drupalBehaviors', [])
.directive('drupalBehaviors', function($timeout) {
return {
restrict: 'AE',
link: function(scope, element, attrs) {
function attach() {
$timeout(function() {
Drupal.attachBehaviors(element.get(0), drupalSettings);
});
@joelstein
joelstein / README.md
Last active August 29, 2015 14:13
CKEditor custom styles
  • If Advanced Content Filter is enabled, need to configure "extra allowed content" to let elements have classes.
  • A catch all value is *(*), which means any element can have any class added to it.
  • To refine this, you can limit available classes, like *(left, right), which will only let "left" and "right" classes be added.
  • Enhanced Image (image2 plugin) can only be targeted through a "widget" type, by defining type: 'widget' and then widget: 'image'.
@joelstein
joelstein / _base.sass
Last active August 29, 2015 14:13
Common Sass stuff
// Responsive images.
img, media
max-width: 100%
// Messages.
.messages
margin: 1em 0
// Tabs.
.tabs
@joelstein
joelstein / custom.module
Last active August 29, 2015 14:08
Drupal Picture/Breakpoints Image Styles Generator
<?php
/**
* Configure ratios, columns, breakpoints, and other stuff.
*/
function custom_config() {
return array(
'ratios' => array(
'wide' => array('width' => 1, 'height' => .5),
'normal' => array('width' => 1, 'height' => .75),