Skip to content

Instantly share code, notes, and snippets.

View DouglasPioStudiare's full-sized avatar

douglascpioc DouglasPioStudiare

View GitHub Profile
@mcshakes
mcshakes / Rails C error.
Created October 14, 2016 23:45
Running into RVM and readline issues
$ rails c
Running via Spring preloader in process 7916
/Users/edmac/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require': dlopen(/Users/edmac/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/x86_64-darwin14/readline.bundle, 9): Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib (LoadError)
Referenced from: /Users/edmac/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/x86_64-darwin14/readline.bundle
Reason: image not found - /Users/edmac/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/x86_64-darwin14/readline.bundle
Fixed with:
ln -s /usr/local/opt/readline/lib/libreadline.7.0.dylib /usr/local/opt/readline/lib/libreadline.6.dylib
@jdforsythe
jdforsythe / git-rename-stash.sh
Created October 28, 2016 13:45
Rename Git Stash
#!/bin/bash
git stash list
echo "Enter stash number to rename"
read stash_number
echo "Enter new name"
read new_name
stash_name="stash@{${stash_number}}"
echo "$stash_name"
@jgoizueta
jgoizueta / application_helper.rb
Created February 24, 2017 19:42
Rails helpers to define tables column-wise
# encoding: UTF-8
module ApplicationHelper
# ...
def concat_content_tag(*args, &blk)
concat content_tag(*args, &blk)
end
end
@bloodredsun
bloodredsun / ExampleThatLogs.java
Last active March 9, 2022 08:16
Unit testing logback based logging statements
package com.brs;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Simple class that we use to trigger a log statement.
*/
public class ExampleThatLogs {
@phoenixg
phoenixg / header_http_status_codes.php
Created April 6, 2013 14:02
PHP header() for sending HTTP status codes
<?php
/*
参考自:
http://darklaunch.com/2010/09/01/http-status-codes-in-php-http-header-response-code-function
http://snipplr.com/view/68099/
*/
function HTTPStatus($num) {
$http = array(
@biklas7
biklas7 / README.md
Last active March 21, 2024 20:28
A Gradle task that generates and publish an Android .apk file to an S3 bucket.

Publish Android .apk file to an S3 bucket

Setup your S3 variables

You can either set up the S3 variables for all projects or per individual project if you prefer. In this example, I will do it for all projects. Just open the build.gradle file and add the following code.

allprojects {
    project.ext.AWS_S3_BUCKET = "YOUR BUCKET NAME"
@onjin
onjin / docker-compose.yml
Created September 5, 2016 09:17
example docker compose for postgresql with db init script
postgres:
image: postgres:9.4
volumes:
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
@romuald
romuald / processlist.sql
Last active April 16, 2024 20:15
Show PostgreSQL current (running) process list;
SELECT user, pid, client_addr, waiting, query, query_start, NOW() - query_start AS elapsed
FROM pg_stat_activity
WHERE query != '<IDLE>'
-- AND EXTRACT(EPOCH FROM (NOW() - query_start)) > 1
ORDER BY elapsed DESC;
@Ryanb58
Ryanb58 / install.md
Last active April 19, 2024 08:38
How to install telnet into a alpine docker container. This is useful when using the celery remote debugger in a dev environment.
>>> docker exec -it CONTAINERID /bin/sh
/app # telnet
/bin/sh: telnet: not found

/app # apk update
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
v3.7.0-243-gf26e75a186 [http://dl-cdn.alpinelinux.org/alpine/v3.7/main]
v3.7.0-229-g087f28e29d [http://dl-cdn.alpinelinux.org/alpine/v3.7/community]
@mihow
mihow / load_dotenv.sh
Last active April 25, 2024 14:18
Load environment variables from dotenv / .env file in Bash
if [ ! -f .env ]
then
export $(cat .env | xargs)
fi