Skip to content

Instantly share code, notes, and snippets.

View chayn1k's full-sized avatar

Pavel Tchaikovsky chayn1k

View GitHub Profile
@chayn1k
chayn1k / pr.md
Created July 28, 2016 14:46 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@chayn1k
chayn1k / README.md
Created June 21, 2016 08:18 — forked from fnichol/README.md
Download a cacert.pem for RailsInstaller

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)

@chayn1k
chayn1k / vanilla-js-cheatsheet.md
Created April 25, 2016 14:58 — forked from thegitfather/vanilla-js-cheatsheet.md
Vanilla JavaScript Quick Reference / Cheatsheet
@chayn1k
chayn1k / phinx-migrate-all.php
Last active March 16, 2016 18:30 — forked from niksamokhvalov/phinx-migrate-all.php
Phinx console command for execute migrations of the all shards http://samokhvalov.info/blog/all/phinx-multiple-databases/
<?php
/**
* Console command for Phinx with argument "all" for executed migrations for multiple databases.
*
* Structure directory for migrations and configs:
* ```
* migrations/
* .db1/
* .db2/
* .db3/
@chayn1k
chayn1k / README.md
Created March 14, 2016 11:40 — forked from agnoster/README.md
My ZSH Theme

agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

For Mac users, I highly recommend iTerm 2 + Solarized Dark

@chayn1k
chayn1k / html5-dataset.js
Created March 4, 2016 07:33 — forked from brettz9/html5-dataset.js
Dataset Shim
/**
* Add dataset support to elements
* No globals, no overriding prototype with non-standard methods,
* handles CamelCase properly, attempts to use standard
* Object.defineProperty() (and Function bind()) methods,
* falls back to native implementation when existing
* Inspired by http://code.eligrey.com/html5/dataset/
* (via https://github.com/adalgiso/html5-dataset/blob/master/html5-dataset.js )
* Depends on Function.bind and Object.defineProperty/Object.getOwnPropertyDescriptor (polyfills below)
* All code below is Licensed under the X11/MIT License
@chayn1k
chayn1k / gist:ea346d070acd494e2f30
Created February 5, 2016 07:58 — forked from rrobe53/gist:976610
Node.js File Extension Content Type
exports.ext = function () {
var extTypes = {
"3gp" : "video/3gpp"
, "a" : "application/octet-stream"
, "ai" : "application/postscript"
, "aif" : "audio/x-aiff"
, "aiff" : "audio/x-aiff"
, "asc" : "application/pgp-signature"
, "asf" : "video/x-ms-asf"
, "asm" : "text/x-asm"
@chayn1k
chayn1k / media-query-mixins.styl
Created January 28, 2016 20:33 — forked from eyy/media-query-mixins.styl
Media query mixins for Stylus
// Media query mixins
mobile()
@media (max-width: 640px)
{block}
tablet()
@media (max-width: 800px)
{block}
@chayn1k
chayn1k / gist:6ed043354f1e88fabfe1
Created December 2, 2015 19:53 — forked from leebyron/gist:5818233
React logo SVG
<svg version="1.1" width="184px" height="166px" viewBox="0 0 184 166">
<g transform="translate(92 83)">
<circle fill="#fff" r="16" />
<g fill="none" stroke="#fff" stroke-width="8">
<ellipse rx="84" ry="32" />
<ellipse rx="84" ry="32" transform="rotate(120)" />
<ellipse rx="84" ry="32" transform="rotate(60)" />
</g>
</g>
</svg>