Skip to content

Instantly share code, notes, and snippets.

View msroot's full-sized avatar
:octocat:

Yannis Kolovos msroot

:octocat:
View GitHub Profile
ssh-agent -s #start the agent
eval `ssh-agent -s` #or this to start
ssh-add -K ~/.ssh/id_rsa #add
ssh-add -l #list identities
ssh -vT [email protected]
ssh-add -D #remove existing identities
ssh-agent #copy the lines & run them
ssh-add #uses the output from above
#Bash:
function get_partner_token {
echo $(cd /Users/Ioannis/project/api && bundle exec pry -r ./app/setup -e "puts Partner.last.token; exit") | grep -oE '[^ ]+$'
}
Start rails server
LOCAL_PARTNER_TOKEN=$(get_partner_token) rails s
@msroot
msroot / gist:135e967cb7e015649254
Created November 12, 2015 14:36
Inspect rack ENV
class EnvInspector
def self.call(env)
[200, {}, env.inspect]
end
end
Rack::Server.start :app => EnvInspector
@msroot
msroot / gist:2b19f9abbd6314d659a9
Last active November 2, 2015 09:01
Detect file encoding to current dir
encodings = []
not_utf8 = []
Dir.glob(Dir.new(".").path + '/**/*.rb') do |file|
contents = File.read(file)
detection = CharlockHolmes::EncodingDetector.detect(contents)
encodings << detection[:encoding]
not_utf8 << {file: file, detection: detection} unless "UTF-8" == detection[:encoding]
end
@msroot
msroot / .tm_properties
Created August 28, 2015 06:03
exclude directories from textmate project
excludeDirectories = "{$excludeDirectories,tmp,log,public}"
#1 .ApplicationController
class ApplicationController < ActionController::Base
around_filter :set_time_zone
def set_time_zone(&block)
time_zone = current_user.shop.try(:timezone) || 'UTC'
Time.use_zone(time_zone, &block)
end
<!DOCTYPE html>
<head>
<title>Stay Standalone</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<script src="stay_standalone.js" type="text/javascript"></script>
</head>
<body>
<ul>
<li><a href="http://google.com/">Remote Link (Google)</a></li>
@msroot
msroot / gist:0264571f6dfeaaca4a08
Created May 22, 2015 04:11
YBoss generate Oauth url
require 'uri'
require 'cgi'
require 'openssl'
require 'base64'
module YBoss
class Oauth
attr_accessor :consumer_key, :consumer_secret, :token, :token_secret, :req_method,
:sig_method, :oauth_version, :callback_url, :params, :req_url, :base_str
## This gist is intended to provide a code example for the
# 'Making Signed Requests' section of the 'Authentication Overview' document.
# (http://developer.netflix.com/docs/Security).
#
# We are going to make a catalog request. The hardest part of
# it is figuring out how to generate the oauth_signature.
require 'cgi'
require 'base64'
require 'openssl'

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>