Skip to content

Instantly share code, notes, and snippets.

View georgismitev's full-sized avatar

Georgi Mitev georgismitev

  • Zurich, Switzerland
View GitHub Profile
@georgismitev
georgismitev / alert-dialog.java
Created January 17, 2015 11:45
android show an alert dialog
addHomeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context);
// set title
alertDialogBuilder.setTitle("Your Title");
// set dialog message
alertDialogBuilder
@georgismitev
georgismitev / gist:973ac61aad5eeb10665c
Last active August 29, 2015 14:13
How to setup multiple ssh keys?
require 'Benchmark'
def balanced_delimiters?(text)
openers = []
matchers = {
')' => '(',
']' => '[',
'}' => '{'
}
text.chars.each do |char|
require 'rblineprof'
module Rblineprof
module ConsoleHelpers
include Rblineprof::Helpers
def lineprof_block(options = {}, &block)
profile = lineprof(rblineprof_profiler_regex(options[:lineprofiler])) do
ret = yield
end
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
bg:
devise:
confirmations:
confirmed: "Вашият профил беше успешно потвърден. Влязохте успешно в него."
send_instructions: "Ще получите писмо с инструкции как да потвърдите вашия профил до няколко минути."
send_paranoid_instructions: "Ако вашият имейл адрес съществува в базата ни, ще получите там инструкции как да потвърдите вашия профил."
failure:
already_authenticated: "Вече сте влязъл в профила си."
<% flash.each do |type, message| %>
<div class="alert <%= bootstrap_class_for(type) %> fade in">
<button class="close" data-dismiss="alert">×</button>
<%= message %>
</div>
<% end %>
# folder content
# -rw-r--r--@ 1 G staff 1275020804 3 Sep 10:55 package.box
# vagrant box remove package # if needed remove all files from virtual box
# vagrant setup
vagrant box add package package.box
vagrant init package
vagrant up
vagrant ssh
require 'cherti/all'
include Cherti
def create_ad_url_override(user_id, ad_url, lang='ad')
device_types = ['mobile', 'tablet', 'pc']
device_types.each do |dt|
AdUrl.find_or_create(:auth_provider => User[user_id].auth_provider, :device_type => dt, :lang => lang, :url => ad_url)
end
end
"googleanalytics","google-analytics.com/ga.js"
"quantcast",".quantserve.com/quant.js"
"comscore","http://int.sitestat.com/comscore/"
"omniture","<!-- SiteCatalyst"
"facebook","<meta property=""fb:app_id"" conten"
"chartbeat","static.chartbeat.com/js/chartbeat.js"
"googleecom","google_conversion_id"
"floodlight","https://fls.doubleclick.net/activityi"
"nielsen","imrworldwide.com"
"webtrends","dcsMultiTrack"
// Url.js from https://github.com/Mikhus/jsurl
function isiOS() {
return navigator.userAgent.match(/(iPad|iPhone|iPod)/g) ? true : false;
}
function isSafari() {
var ua = navigator.userAgent.toLowerCase();
return (ua.indexOf('safari') !== -1) && ua.indexOf('chrome') === -1;
}