Skip to content

Instantly share code, notes, and snippets.

@lazaronixon
lazaronixon / _form.html.erb
Last active June 6, 2025 19:24
Dropzone.js + Stimulus + Active Storage + CSS Zero (2025)
<%= form_with(model: billboard) do |form| %>
<%= tag.div class: "dropzone", data: { controller: "dropzone", dropzone_param_name_value: "billboard[images][]", dropzone_url_value: rails_direct_uploads_url, dropzone_accepted_files_value: "image/*", dropzone_max_files_value: 3, dropzone_max_filesize_value: 0.300 } do %>
<div class="dz-default dz-message flex flex-col items-center">
<%= image_tag "upload.svg", size: 28, class: "colorize-black", aria: { hidden: true } %>
<h5 class="font-semibold mbs-4">Drop files here or click to upload.</h5>
<p class="text-sm text-subtle">Upload up to 10 files.</p>
</div>
<% end %>
<div class="inline-flex items-center mbs-2 mie-1">
@zthxxx
zthxxx / Activate Office 2019 for macOS VoL.md
Last active July 16, 2025 19:45
crack activate Office on mac with license file
@liangfu
liangfu / ffmpeg.md
Created May 24, 2017 04:46 — forked from protrolium/ffmpeg.md
using ffmpeg to extract audio from video files

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:

@boie0025
boie0025 / gist:ae9697eed61cbf5342a6
Last active May 17, 2017 20:20
scraper-psuedocode-exmaple
module Producers
class DataModelA
... # Some ruby magic to return the correct subclass for a state
def page
@page ||= Nokogiri.new(URL)
end
end
class SpecificState < DataModelA
@johnbintz
johnbintz / simple-capistrano-docker-deploy.rb
Last active June 6, 2025 20:51
Simple Capistrano deploy for a Docker-managed app
# be sure to comment out the require 'capistrano/deploy' line in your Capfile!
# config valid only for Capistrano 3.1
lock '3.2.1'
set :application, 'my-cool-application'
# the base docker repo reference
set :name, "johns-stuff/#{fetch(:application)}"
@amergin
amergin / angular-packery.js
Created August 6, 2014 00:24
Angular-masonry fork for Packery.js
/*!
* angular-packery
* Forked from angular-masonry (Pascal Hartig, weluse GmbH, http://weluse.de/)
*/
(function () {
'use strict';
angular.module('wu.packery', []).controller('PackeryCtrl', [
'$scope',
'$element',
'$timeout',
# config/routes.rb
resources :documents do
scope module: 'documents' do
resources :versions do
post :restore, on: :member
end
resource :lock
end
end
@gvarela
gvarela / setup
Last active May 17, 2023 15:19
A bash rails setup script to help someone get started on a rails project.
#!/usr/bin/env bash
{
RUBY_VERSION=$(cat .ruby-version)
RUBY_VERSION=${RUBY_VERSION:=2.1.0}
PROJECT_NAME=__PROJECT_NAME__
} >/dev/null 2>&1
## bootstrap function called at bottom of file comment out verification steps you don't need
init (){
verify_ruby_version &&
@booleanbetrayal
booleanbetrayal / Gruntfile.js
Last active June 6, 2025 20:58
Example GruntJS configuration for a replacement to the Sprockets Rails asset pipeline
'use strict';
module.exports = function(grunt) {
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
// configurable paths
var paths = {
@ihassin
ihassin / dbserver.yml
Created December 24, 2013 00:17
Ansible script to install mySQL
- hosts: webservers
user: vagrant
sudo: true
vars_files:
- vars.yml
tasks:
- name: Install MySQL
action: apt pkg=$item state=installed
with_items: