Skip to content

Instantly share code, notes, and snippets.

View doromones's full-sized avatar
🚀
per rectum ad astrum

Anton doromones

🚀
per rectum ad astrum
  • Starladder
  • Ukraine, Kiev
  • 09:12 (UTC +02:00)
View GitHub Profile
@doromones
doromones / gist:7132464
Last active December 26, 2015 09:49
Js errors to google analitics
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-44856908-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = 'https://ssl.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
@doromones
doromones / getpage_meta_and_title.user.js
Last active December 26, 2015 10:19
get page title and meta desrc tampermonkey/greasemonkey
// ==UserScript==
// @name get meta descr
// @namespace http://use.i.E.your.homepage/
// @version 0.5
// @description получаем мета дескрипшен
// @match http://*/*
// @copyright 2012+, You
// @require http://code.jquery.com/jquery-latest.js
// @updateUrl https://gist.github.com/doromones/7136297/raw/getpage_meta_and_title.user.js
// ==/UserScript==
#!/usr/bin/env ruby
# Complete rake tasks script for bash
# Save it somewhere and then add
# complete -C path/to/script -o default rake
# to your ~/.bashrc
# Xavier Shay (http://rhnh.net), combining work from
# Francis Hwang ( http://fhwang.net/ ) - http://fhwang.net/rb/rake-complete.rb
# Nicholas Seckar <[email protected]> - http://www.webtypes.com/2006/03/31/rake-completion-script-that-handles-namespaces
# Saimon Moore <[email protected]>
@doromones
doromones / README.md
Last active April 8, 2018 01:47 — 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)

@doromones
doromones / Vagrantfile
Created March 9, 2015 08:10
Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
network.protocol-handler.warn-external.txmt boolean false
network.protocol-handler.external.txmt boolean true
#the last one is the path to the script we're about to create
network.protocol-handler.app.txmt string ~/protocol_handler/prot.sh
# I ended up needing this one as well on another machine, (no idea why)
network.protocol-handler.expose.txmt boolean false
# http://ezprompt.net/
# get current branch in git repo
function parse_git_branch() {
BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
if [ ! "${BRANCH}" == "" ]
then
STAT=`parse_git_dirty`
echo "[${BRANCH}${STAT}]"
else
echo ""
#!/usr/bin/env bash
TARGET_URL=http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.5.tar.gz
PATCH_URL=https://gist.github.com/kou1okada/3956838/raw/ruby-2.1.5.cygwin64.patch
HASH="$(cat <<EOD
df4c1b23f624a50513c7a78cb51a13dc *ruby-2.1.5.tar.gz
feba105b7393c36df66eb34daf937974 *ruby-2.1.5.cygwin64.patch
EOD
)"
TARGET_ARCHIVE="${TARGET_URL##*/}"
Make sure libxml2-devel, libxslt-devel and libiconv-devel are installed:
$ gem install nokogiri -- --use-system-libraries --with-xml2-include=/usr/include/libxml2 --with-xml2-lib=/usr/lib --with-xslt-dir=/usr/include/libxslt --with-iconv-include=/usr/include --with-iconv-lib=/usr/lib
@doromones
doromones / AngularBaseCtrl.coffee
Last active April 8, 2018 01:47 — forked from elado/AngularBaseCtrl.coffee
Angular.js CoffeeScript Controller Base Class
# dependency - Function.prototype.bind or underscore/lodash
app = angular.module 'someApp'
class @BaseCtrl
@register: (app, name) ->
name ?= @name || @toString().match(/function\s*(.*?)\(/)?[1]
app.controller name, @
@inject: (args...) ->