Skip to content

Instantly share code, notes, and snippets.

View belgoros's full-sized avatar

Serguei Cambour belgoros

View GitHub Profile
@belgoros
belgoros / pr.md
Created July 19, 2016 07:44 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@belgoros
belgoros / AWS S3-Paperclip5-Heroku.md
Created November 3, 2016 21:43
Setup Rails app with Paperclip 5, Amazon S3 and Heroku

Setting Amazon S3 for Paperclip and Heroku

The latest Paperclip release 5.1.0 has changed a little bit the way to set it up with Amazon S3 service (Amazon Simple Storage Service). Moreover, after googling a lot here and there, we could see many solutions and settings, some of them being outdated, some - often different and did not work well. So I decided to summarize in one replace all the steps needed to set up your Rails application deployed on Heroku and be able to use it with Paperclip 5 and Amazon S3 service.

In case you don't know, Heroku does not allow your Rails application to write and offers read only access. What means that you can't use Paperclip and save your files to Heroku's file system.

So you will have to find a way to upload/store/read your files. As stated in Paperclip documentation, Paperclip ships with 3 storage adapters:

@belgoros
belgoros / remove_nodejs.md
Last active November 4, 2017 09:36
Remove node JS from OS X

The best way (I've found) to completely uninstall node + npm is to do the following:

Go to /usr/local/lib and delete any node and node_modules:

cd /usr/local/lib
sudo rm -rf node*

Go to /usr/local/include and delete any node and node_modules directory:

@belgoros
belgoros / json_response.md
Last active December 4, 2017 14:50
JSON response example

I tried to test a single action:

public class ListsController extends APIController  {

    public void index(){
        view("lists", List.findAll().orderBy("id"));
        render().contentType("application/json");
    }
}
@belgoros
belgoros / a-teeny-component.component.js
Created October 26, 2018 15:09 — forked from NullVoxPopuli/a-teeny-component.component.js
Example of passing actions from controller to nested component
import Ember from 'ember';
export default Ember.Component.extend({
// this component only received args from the caller
// but it does track its own local info property
info: '', // initial form field value
});
@belgoros
belgoros / components.a-teeny-component.js
Created October 26, 2018 15:09 — forked from jenweber/components.a-teeny-component.js
Example of passing actions from controller to nested component
import Ember from 'ember';
export default Ember.Component.extend({
});
// 20181203173529
// http://localhost:3000/apidocs
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "Example Project API",
"description": "A Swagger Project API that uses a bla-bla-bla project features in commliance with the swagger-2.0 specification",
"contact": {
@belgoros
belgoros / regexCheatsheet.js
Created January 15, 2019 08:35 — forked from sarthology/regexCheatsheet.js
A regex cheatsheet 👩🏻‍💻 (by Catherine)
let regex;
/* matching a specific string */
regex = /hello/; // looks for the string between the forward slashes (case-sensitive)... matches "hello", "hello123", "123hello123", "123hello"; doesn't match for "hell0", "Hello"
regex = /hello/i; // looks for the string between the forward slashes (case-insensitive)... matches "hello", "HelLo", "123HelLO"
regex = /hello/g; // looks for multiple occurrences of string between the forward slashes...
/* wildcards */
regex = /h.llo/; // the "." matches any one character other than a new line character... matches "hello", "hallo" but not "h\nllo"
regex = /h.*llo/; // the "*" matches any character(s) zero or more times... matches "hello", "heeeeeello", "hllo", "hwarwareallo"
@belgoros
belgoros / lucky_setup.txt
Created February 6, 2019 14:52
Errors when running bin/setup to set up a new Lucky project
lucky-blog git:(master) bin/setup
▸ Installing node dependencies
warning laravel-mix > autoprefixer > [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning laravel-mix > css-loader > cssnano > autoprefixer > [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning laravel-mix > css-loader > cssnano > postcss-merge-rules > [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning laravel-mix > css-loader > cssnano > postcss-merge-rules > caniuse-api > [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning "laravel-mix > [email protected]" has unmet peer dependency "imagemin@^5.0.0 || ^6.0.0".
@belgoros
belgoros / BatchConfiguration.java
Last active May 17, 2020 21:08
spring-batch to fetch PhraseApp translations
package hello;
import hello.dto.PostDto;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;