Skip to content

Instantly share code, notes, and snippets.

View kesha-antonov's full-sized avatar
🏆
Working on great apps

Kesha Antonov kesha-antonov

🏆
Working on great apps
View GitHub Profile
@diegopacheco
diegopacheco / elasticsearch-es-delete-all-data.md
Created August 10, 2016 21:36
How to Delete All Data in Elasticsearch?
curl -XDELETE localhost:9200/*
@JoshKaufman
JoshKaufman / digitalocean console paste.js
Created January 7, 2016 00:17
enables sending string to digitalocean web console stdin
var sendString = (function(rfb, force, sendDelay) {
sendDelay = sendDelay || 25;
var _q = [];
var _qStart = function() {
var chr = _q.shift();
if (chr) {
rfb.sendKey(chr);
setTimeout(_qStart, sendDelay);
}
};
@tolmachevroman
tolmachevroman / DownloadProgressCounter.java
Last active December 14, 2023 17:39
Reflect DownloadManager progress of downloading multiple files in ProgressBar widget
/**
* Fetches how many bytes have been downloaded so far and updates ProgressBar
*/
class DownloadProgressCounter extends Thread {
private final long downloadId;
private final DownloadManager.Query query;
private Cursor cursor;
private int lastBytesDownloadedSoFar;
private int totalBytes;
@just3ws
just3ws / vcr.rb
Created November 5, 2014 15:02
VCR configuration that does a pretty good job of filtering out GitHub, Twitter, and LinkedIn keys.
VCR.configure do |c|
c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
c.hook_into :webmock
c.ignore_localhost = true
c.default_cassette_options = { record: :new_episodes }
c.allow_http_connections_when_no_cassette = false
c.configure_rspec_metadata!
c.ignore_hosts 'codeclimate.com'
@dhoelzgen
dhoelzgen / base_controller.rb
Last active October 7, 2021 16:19
CORS in Rails 4 APIs
class API::V1::BaseController < ApplicationController
skip_before_filter :verify_authenticity_token
before_filter :cors_preflight_check
after_filter :cors_set_access_control_headers
def cors_set_access_control_headers
headers['Access-Control-Allow-Origin'] = '*'
headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'
@gcarrion-gfrmedia
gcarrion-gfrmedia / 0000_packages.config
Created April 29, 2014 10:49
AWS Elastic Beanstalk Ruby 2.0/Puma Environment - .ebextensions tweaks and Sidekiq configuration. This is known to work fine with AWS Elastic Beanstalk 's 64bit Amazon Linux 2014.03 v1.0.1 running Ruby 2.0 (Puma) stack. Later stack versions might not work, but for that specific version works fine.
# Install Git needed for Git based gems
packages:
yum:
git: []
@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@jtomaszewski
jtomaszewski / god.cap.rb
Last active March 7, 2022 01:21
God tasks for Capistrano v3
# Thanks to http://makandracards.com/makandra/1431-resque-+-god-+-capistrano for an idea and v2 version.
namespace :god do
def god_is_running
capture(:bundle, "exec god status > /dev/null 2>&1 || echo 'god not running'") != 'god not running'
end
# Must be executed within SSHKit context
def config_file
"#{release_path}/config/god.rb"
@6ui11em
6ui11em / css-retina-media-queries.css
Created December 13, 2013 08:11
CSS: Retina media queries
@media only screen and (min-width: 320px) {
/* Small screen, non-retina */
}
@media
only screen and (-webkit-min-device-pixel-ratio: 2) and (min-width: 320px),
only screen and ( min--moz-device-pixel-ratio: 2) and (min-width: 320px),
only screen and ( -o-min-device-pixel-ratio: 2/1) and (min-width: 320px),
@julionc
julionc / 00.howto_install_phantomjs.md
Last active April 26, 2024 09:13
How to install PhantomJS on Debian/Ubuntu

How to install PhantomJS on Ubuntu

Version: 1.9.8

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev