Skip to content

Instantly share code, notes, and snippets.

View adis-io's full-sized avatar

Adis Osmonov adis-io

View GitHub Profile
@xrstf
xrstf / letsencrypt.md
Last active October 30, 2024 07:03
Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

This document details how I setup LE on my server. Firstly, install the client as described on http://letsencrypt.readthedocs.org/en/latest/using.html and make sure you can execute it. I put it in /root/letsencrypt.

As it is not possible to change the ports used for the standalone authenticator and I already have a nginx running on port 80/443, I opted to use the webroot method for each of my domains (note that LE does not issue wildcard certificates by design, so you probably want to get a cert for www.example.com and example.com).

Configuration

For this, I placed config files into etc/letsencrypt/configs, named after <domain>.conf. The files are simple:

@maxivak
maxivak / readme.md
Last active February 19, 2025 23:23
Integrating Gem/Engine and Main Rails App
@bensaufley
bensaufley / wpautop.rb
Last active October 16, 2015 10:24 — forked from goofmint/wpautop for ruby
wpautop for Ruby
###
# Replaces double line-breaks with paragraph elements.
#
# A group of regex replaces used to identify text formatted with newlines and
# replace double line-breaks with HTML paragraph tags. The remaining
# line-breaks after conversion become <<br />> tags, unless $br is set to '0'
# or 'false'.
#
# @since 0.71
#
@ScreamingDev
ScreamingDev / sendmail
Last active July 12, 2016 19:11
PHP local send mail (/usr/local/bin/sendmail)
#!/usr/bin/php
<?php
$input = file_get_contents('php://stdin');
preg_match('|^To: (.*)|', $input, $matches);
$filename = tempnam('/var/log/mail', date('ymd-his-') . $matches[1] . '.');
file_put_contents($filename, $input);
@dhoelzgen
dhoelzgen / base_controller.rb
Last active October 7, 2021 16:19
CORS in Rails 4 APIs
class API::V1::BaseController < ApplicationController
skip_before_filter :verify_authenticity_token
before_filter :cors_preflight_check
after_filter :cors_set_access_control_headers
def cors_set_access_control_headers
headers['Access-Control-Allow-Origin'] = '*'
headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'
@staltz
staltz / introrx.md
Last active April 24, 2025 06:10
The introduction to Reactive Programming you've been missing
@feliperoberto
feliperoberto / gist:9793674
Created March 26, 2014 21:11
GulpJS + SASS + BrowserSync ftw

#GulpJS + SASS + BrowserSync ftw Being the new-kid-on-the-block, GulpJS is getting plently of attention lately. Instead of contributing to the pool of opinion-pieces out there though, I thought I'd walk you through setting it up with a really nice little workflow including SASS for CSS along with my open-source project, BrowserSync.io.

The end result will be a pretty sweet front-end development setup including:

  • SCSS File watching/compilation.
  • Live CSS injecting into multiple devices.
  • A Server running on an IP address that can be accessed on multiple devices/screens.
  • Syncronized scroll, clicks, links & form fields across all devices.
@valerykalashnikov
valerykalashnikov / LocalStorageCache.js
Last active August 29, 2015 13:57
LocalStorageCache
var cache = (function() {
'use strict';
var TTL_POSTFIX = 'time2live';
var TTE_POSTFIX = 'time2expire';
function _hasLocalStorage() {
if (!window.localStorage) {
throw new Error('you have no localStorage');
}
}
function _removeCachedKey(key) {
@Fivell
Fivell / have_xml.rb
Created December 18, 2013 17:00 — forked from faun/have_xml.rb
require 'nokogiri'
RSpec::Matchers.define :have_xml do |xpath, text|
match do |body|
doc = Nokogiri::XML::Document.parse(body)
nodes = doc.xpath(xpath)
nodes.empty?.should be_false
if text
nodes.each do |node|
node.content.should == text
end
@kapv89
kapv89 / SingleTableInheritance.php
Created July 28, 2013 23:39
Abstract Eloquent Use Case
class Order extends AbstractEloquent {
protected $isSuperType = true;
protected $typeField = 'class';
}
namespace Order;
class Delivery extends Order {
protected $isSubType = true;
}