Skip to content

Instantly share code, notes, and snippets.

View devhero's full-sized avatar
😁

Andrea Parisi devhero

😁
  • devhero
  • Milan
View GitHub Profile
@twoneks
twoneks / remote heroku
Created April 20, 2015 15:43
add remote heroku
# remote list
git remote -v
# add heroku app remote
heroku git:remote --app brenda-kp
git remote -v
# heroku https://git.heroku.com/brenda-kp.git
# rename local remote
@devhero
devhero / lectures
Created May 31, 2016 07:36
lectures
https://blog.8thlight.com/uncle-bob/2012/08/13/the-clean-architecture.html
http://www.taimila.com/blog/ddd-and-testing-strategy/
@toolmantim
toolmantim / sidetiq_schedule_time_zone_additions.rb
Last active November 30, 2016 18:59
An addition to Sidetiq to make it easier to declare the worker's schedule's timezone. Assumes ActiveRecord::TimeZone is available.
# Timezone extension to Sidetiq
Sidetiq::Schedulable::ClassMethods.class_eval do
# Sets the time zone for the recurrence rules.
#
# Example:
#
# class MyWorker
# include Sidekiq::Worker
# include Sidetiq::Schedulable
#
@tibbiyelininja
tibbiyelininja / absurl.py
Last active January 12, 2017 09:48
Django Absolute URL Node with Active Property
from django.template import Library
from django.template.defaulttags import URLNode, url
register = Library()
class AbsoluteURL(str):
pass
class AbsoluteURLNode(URLNode):
def render(self, context):
@maximum-pixels
maximum-pixels / paginate_helper.rb
Created November 26, 2015 15:05
This is a custom link renderer that will format the pagination bar with Bootstrap4 as well as AJAX (i.e. data-remote="true") to use jquery-ujs rails
module PaginateHelper
class PaginateJSLinkRenderer < WillPaginate::ActionView::LinkRenderer
def prepare(collection, options, template)
options[:params] ||= {}
options[:params]['_'] = nil
super(collection, options, template)
end
protected
def html_container(html)
@Couto
Couto / webpack.js
Last active November 11, 2020 17:53
Fetch polyfill with webpack
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var path = require('path');
var folders = {
APP: path.resolve(__dirname, '../app'),
BUILD: path.resolve(__dirname, '../build'),
BOWER: path.resolve(__dirname, '../bower_components'),
NPM: path.resolve(__dirname, '../node_modules')
};
@lost-theory
lost-theory / gist:3005268
Created June 27, 2012 16:35
consume JSON REST API blueprint inside flask app
from flask import Flask, jsonify, Blueprint, current_app
import json
## REST api ###################################################################
api = Blueprint('api', __name__)
@api.route("/users")
def users():
return jsonify(users=[
@zachary-russell
zachary-russell / sqoosh-image.sh
Last active August 7, 2022 13:37
Squoosh CLI Optimization
squoosh-cli --mozjpeg '{"quality":75,"baseline":false,"arithmetic":false,"progressive":true,"op timize_coding":true,"smoothing":0,"color_space":3,"quant_table":3,"trellis_multipass":false,"trel lis_opt_zero":false,"trellis_opt_table":false,"trellis_loops":1,"auto_subsample":true,"chroma_sub sample":2,"separate_chroma_quality":false,"chroma_quality":75}' actionvance-guy5aS3GvgA-unsplash.jpg
@devhero
devhero / ffmpeg cookbook
Last active January 19, 2023 10:56
ffmpeg cookbook
# rotate
ffmpeg -i input.mp4 -map_metadata 0 -c copy -metadata:s:v rotate="180" output.mp4
# extract subs from mp4
# https://superuser.com/questions/393762/how-to-extract-subtitles-from-mp4-and-mkv-movies
ffmpeg -i video.mp4 subtitle.srt
# convert audio (using vbr)
ffmpeg -i input.mkv -c:a libopus -b:a 256k -vbr 1 -af "channelmap=channel_layout=5.1" output.mkv
@DamianEdwards
DamianEdwards / json-in-markdown.md
Last active June 2, 2023 17:20
JSON comments on GH

What happens if you tell GitHub it's JSON

{
  "hello": "world" // I want my comments!
}

Just tell GitHub it's JavaScript

{