Skip to content

Instantly share code, notes, and snippets.

View zemd's full-sized avatar
🇺🇦

Dmytro Zelenetskyi zemd

🇺🇦
  • Ikea IT AB
  • Malmö, Sweden
View GitHub Profile
@zemd
zemd / gist:5842507
Created June 22, 2013 20:41
install pyrus
:: Apache License, Version 2.0
:: http://www.apache.org/licenses/LICENSE-2.0
:: Copyright 2012 Dmitry Zelenetskiy (dmitry.zelenetskiy@gmail.com)
@ECHO OFF
VERIFY OTHER 2>nul
SETLOCAL ENABLEEXTENSIONS
IF ERRORLEVEL 1 ECHO Unable to enable extensions
IF DEFINED PYRUS_HOME (GOTO PYRUS_RUN) ELSE (GOTO PYRUS_NOT_INSTALLED)
# Generate Private Key
$ openssl genrsa -out server.key 2048
# Generate CSR
$ openssl req -new -out server.csr -key server.key -config openssl.cnf
# => Fill in info
# Check CSR
$ openssl req -text -noout -in server.csr
# Sign Cert
$ openssl x509 -req -days 3650 -in server.csr -signkey server.key -out server.crt -extensions v3_req -extfile openssl.cnf
$sprites: sprite-map("sprites/*.png");
$sprites-retina: sprite-map("sprites-retina/*.png");
@mixin sprite-background($name) {
background-image: sprite-url($sprites);
background-position: sprite-position($sprites, $name);
background-repeat: no-repeat;
display: block;
height: image-height(sprite-file($sprites, $name));
width: image-width(sprite-file($sprites, $name));
<!DOCTYPE html>
<!--[if IE 8]> <html lang="sv-SE" class="no-js ie8"> <![endif]-->
<!--[if gt IE 8]><!--> <html lang="sv-SE" class="no-js"> <!--<![endif]-->
<head>
<meta charset="UTF-8">
<title>Breakpoint detection test</title>
<style type="text/css" media="screen">
@media screen and (min-width: 320px) {
#page:after {
content: 'smallest'; /* represent the current width-bracket */
@zemd
zemd / gist:8386119
Created January 12, 2014 15:34 — forked from zbal/gist:7800423
# Based on https://gist.github.com/fernandoaleman/5083680
# Start the old vagrant
$ vagrant init ubuntu_saucy
$ vagrant up
# You should see a message like:
# [default] The guest additions on this VM do not match the install version of
# VirtualBox! This may cause things such as forwarded ports, shared
# folders, and more to not work properly. If any of those things fail on
@zemd
zemd / gist:8547144
Created January 21, 2014 19:55
hstore extension with rails migrations
class SetupHstore < ActiveRecord::Migration
def self.up
enable_extension "hstore"
end
def self.down
disable_extension "hstore"
end
end
@zemd
zemd / README.md
Created January 30, 2014 22:14 — forked from fnichol/README.md

Why?

There is a long standing issue in Ruby where the net/http library by default does not check the validity of an SSL certificate during a TLS handshake. Rather than deal with the underlying problem (a missing certificate authority, a self-signed certificate, etc.) one tends to see bad hacks everywhere. This can lead to problems down the road.

From what I can see the OpenSSL library that Rails Installer delivers has no certificate authorities defined. So, let's go fetch some from the curl website. And since this is for ruby, why don't we download and install the file with a ruby script?

Installation

The Ruby Way! (Fun)

@zemd
zemd / gist:8819458
Created February 5, 2014 08:41
remove files from git after .gitignore updated
git rm --cached `git ls-files -i --exclude-from=.gitignore`
@zemd
zemd / gist:4eb1969f1de30a4d098f
Created June 22, 2014 14:39
recursive rmdir
<?php
$dirPath = __DIR__.'/../app/cache/dev';
if (file_exists($dirPath)) {
foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dirPath, FilesystemIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST) as $path) {
$path->isDir() ? rmdir($path->getPathname()) : unlink($path->getPathname());
}
rmdir($dirPath);
}