Skip to content

Instantly share code, notes, and snippets.

View colmarius's full-sized avatar
💭
🎶 🎹

Marius Colacioiu colmarius

💭
🎶 🎹
View GitHub Profile
@plusjade
plusjade / international-support.json
Last active December 21, 2015 18:29
Elasticsearch-ing How I make sense of what the hell is going on in ES. Essentially a "control test" environment. Validate the minimum possible use-case, then iterate by one factor. Note I don't have any comments in there because you can copy and paste the entire top half into console and it will run in sequence.
curl -XDELETE 'http://localhost:9200/p'
curl -XPOST 'http://localhost:9200/p' -d '
{
"index" : {
"analysis" : {
"analyzer" : {
"default_index" : {
"tokenizer" : "standard",
"filter" : ["lowercase", "asciifolding", "mynGram"],
@linjunpop
linjunpop / deploy-rails-4-app-with-dokku-on-digital-ocean.md
Last active May 30, 2023 08:20
Deploy Rails 4 app with Dokku on DigitalOcean

Deploy Rails 4 app with Dokku on DigitalOcean

Install dokku

First create a Ubuntu 13.04 x64 droplet on DigitalOcean Control Panel

Then ssh with root account, run this in termianl:

$ wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh | sudo bash
@plusjade
plusjade / log.rb
Last active July 15, 2019 23:08
Custom rails logger
# place in ./config/initializers
# Usage
# LL.warn "blah"
# LL.warn @profile.inspect
require 'pp'
require 'log4r'
require 'log4r/configurator'
require 'log4r/yamlconfigurator'
require 'log4r/outputter/fileoutputter'
@justincampbell
justincampbell / after.sh
Created March 1, 2013 17:45
Jenkins + GitHub Commit Status API
if [[ $BUILD_STATUS == "success" ]]
then
export STATUS="success"
else
export STATUS="failure"
fi
curl "https://api.github.com/repos/justincampbell/my_repo/statuses/$GIT_COMMIT?access_token=abc123" \
-H "Content-Type: application/json" \
-X POST \
@chrismo
chrismo / README.md
Last active October 19, 2016 20:32
Bundler 1.3 --binstubs vs. Rails 4

On a clean Rails 4 install with Bundler 1.3.0, using --binstubs causes competition between Rails and Bundler for the contents of bin/rails (and bin/rake).

Just running bundle will rewrite the Rails version of bin/rails to a version that doesn't work.

The fix is to use the new bundle binstubs <gemname> command.

(see rails/rails#8974)

@masonforest
masonforest / gist:4048732
Created November 9, 2012 22:28
Installing a Gem on Heroku from a Private GitHub Repo

Installing a Gem on Heroku from a Private GitHub Repo

Sometimes you want to use a gem on Heroku that is in a private repository on GitHub.

Using git over http you can authenticate to GitHub using basic authentication. However, we don't want to embed usernames and passwords in Gemfiles. Instead, we can use authentication tokens.

  1. Get an OAuth Token from GitHub

First you will need to get an OAuth Token from GitHub using your own username and "note"

$('a[data-mixpanel-tracker]').click ->
setTimeout (=> window.location.href = $(@).attr('href')), 300
tracker = $(@).attr('data-mixpanel-tracker')
properties = JSON.parse($(@).attr('data-mixpanel-properties') || '{}')
mixpanel.track tracker, properties
return false

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@jancel
jancel / gist:1367606
Created November 15, 2011 17:01 — forked from r00k/gist:906356
Custom devise strategy
# In config/initializers/local_override.rb:
require 'devise/strategies/authenticatable'
module Devise
module Strategies
class LocalOverride < Authenticatable
def valid?
true
end