Skip to content

Instantly share code, notes, and snippets.

@iammart
iammart / bitbucket-pipelines.yml
Created February 10, 2021 08:26 — forked from chimit/bitbucket-pipelines.yml
Bitbucket Pipelines config for Laravel 7 with PHP 7.4, GD and EXIF
# This is a sample build configuration for PHP.
# Check our guides at https://confluence.atlassian.com/x/e8YWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: php:7.4-fpm
definitions:
services:
mysql:
@iammart
iammart / validation.php
Created November 18, 2019 09:08 — forked from nWidart/validation.php
A extensions validation rule for Laravel 5
<?php
// For example in AppServiceProvider
Validator::extend('extensions', function ($attribute, $value, $parameters) {
return in_array($value->getClientOriginalExtension(), $parameters);
});
Validator::replacer('extensions', function($message, $attribute, $rule, $parameters) {
return str_replace([':attribute', ':values'], [$attribute, implode(',', $parameters)], $message);
});
@iammart
iammart / media-queries-b3.scss
Created July 17, 2018 08:02 — forked from akolinski/media-queries-b3.scss
Media queries using SCSS in Bootstrap 3
// Using bootstrap the SASS way. Import your variables.
@import "bower_components/bootstrap-sass-official/assets/stylesheets/bootstrap/variables";
/* http://getbootstrap.com/css/#responsive-utilities */
/* Extra small devices (phones, less than 768px) */
/* No media query since this is the default in Bootstrap */
// Mobile first
body{
border: solid 4px red;
@iammart
iammart / BaseActivity.java
Created June 15, 2018 11:51 — forked from kshivang/BaseActivity.java
Instagram like ViewPager implementation with bottom tab layout, without recreating fragments in fragment manager on tab select or back click. Implementation is prescribed for ViewPager inside fragment(more complex case) similar thing could be achieved for ViewPager in activity as well.
public abstract class BaseActivity extends AppCompatActivity {
public void moveBack() {
super.onBackPressed();
}
public abstract void onBackWhenNoFragment();
@Override
public void onBackPressed() {
@iammart
iammart / ProfileActivity.java
Created June 1, 2018 09:31 — forked from xvarlez/ProfileActivity.java
Android simple user input validation system, with support for EditText, AutoCompleteTextView, TextInputLayout
/**
* The activity containing your EditTexts.
*/
public class ProfileActivity extends AppCompatActivity {
/**
* Input field "your name".
*/
@Bind(R.id.edittext_name)
EditText nameEditText;
@iammart
iammart / Makefile
Created January 22, 2018 08:01 — forked from AlexDisler/Makefile
.PHONY: run
# certs and output
OUTPUT_FILE=apkname.apk
ALIAS=youralias
KEYPASS=yourkeypass
KEYSTORE=certs/yourcert.keystore
UNSIGNED=platforms/android/build/outputs/apk/android-release-unsigned.apk
# or, if you're using Crosswalk:
@iammart
iammart / how-to-add-image-to-gist.md
Created January 5, 2018 12:23 — forked from remarkablemark/how-to-add-image-to-gist.md
How to add an image to a gist

How to add an image to a gist

  1. Create a gist if you haven't already.
  2. Clone your gist:
    # make sure to replace `<hash>` with your gist's hash
    git clone https://gist.github.com/<hash>.git # with https
    git clone git@gist.github.com:<hash>.git     # or with ssh
@iammart
iammart / localhost-ssl.md
Created November 19, 2017 14:18 — forked from ethicka/localhost-ssl.md
Local virtualhost SSL websites on Mac OS Sierra

Local virtualhost SSL websites on Mac OS Sierra

These instructions will guide you through the process of setting up a wildcard SSL for your local virtualhosts for offline development. Most importantly, this configuration will give you the happy, green lock in Chrome.

These instructions have only been tested on Mac OS Sierra using the pre-installed Apache and PHP versions. These instructions also assume you have virtualhosts set up locally already.


Configuring SSL

Install Supervisor with sudo apt-get install supervisor in Unix or brew install supervisor in Mac OSX. Ensure it's started with sudo service supervisor restart in Unix or brew services start supervisor in Mac OSX.

In Unix in /etc/supervisord/conf.d/ create a .conf file. In this example, laravel_queue.conf (contents below). Give it execute permissions: chmod +x laravel_queue.conf.

In Mac OSX first run supervisord -c /usr/local/etc/supervisord.ini and in /usr/local/etc/supervisor.d/ create a .conf file. In this example, laravel_queue.conf (contents below). Give it execute permissions: chmod +x laravel_queue.conf.

This file points at /usr/local/bin/run_queue.sh, so create that file there. Give this execute permissions, too: chmod +x run_queue.sh.

Now update Supervisor with: sudo supervisorctl reread in Unix and with: brew services restart supervisor in MAc OSX . And start using those changes with: sudo supervisorctl update.