Skip to content

Instantly share code, notes, and snippets.

View zzeroo's full-sized avatar
💤
zzeroo...

zzeroo zzeroo

💤
zzeroo...
View GitHub Profile
<%= simple_form_for @product do |f| %>
<%= f.simple_fields_for :attributes do |d| %>
<% f.object.attributes.try(:each) do |key, value| %>
<%= d.input key, :input_html => {:value => value } %>
<% end %>
<% end %>
<% end %>
@zzeroo
zzeroo / bookmark.min.js
Created May 31, 2019 06:11 — forked from zaydek-old/bookmark.min.js
A *simple* CSS debugger. To use, bookmark "Debug CSS" at https://zaydek.github.io/debug.css. Learn more here https://medium.freecodecamp.org/88529aa5a6a3 and https://youtu.be/2QdzahteCCs?t=1m25s (starts at 1:25)
/* debug.css | MIT License | zaydek.github.com/debug.css */ if (!("is_debugging" in window)) { is_debugging = false; var debug_el = document.createElement("style"); debug_el.append(document.createTextNode(`*:not(g):not(path) { color: hsla(210, 100%, 100%, 0.9) !important; background: hsla(210, 100%, 50%, 0.5) !important; outline: solid 0.25rem hsla(210, 100%, 100%, 0.5) !important; box-shadow: none !important; filter: none !important; }`)); } function enable_debugger() { if (!is_debugging) { document.head.appendChild(debug_el); is_debugging = true; } } function disable_debugger() { if (is_debugging) { document.head.removeChild(debug_el); is_debugging = false; } } !is_debugging ? enable_debugger() : disable_debugger();
@zzeroo
zzeroo / ruby_on_rails_deployment.md
Last active April 1, 2019 09:42 — forked from zentetsukenz/ruby_on_rails_deployment.md
Deploy Ruby on Rails application with Docker Compose and Capistrano with ease

Docker

Files and Folders.

|
|\_ app
|...
|\_ docker
| |
@zzeroo
zzeroo / dropbox_ext4.c
Created February 5, 2019 08:46 — forked from dimaryaz/dropbox_ext4.c
Dropbox ext4 hack
/*
* dropbox_ext4.c
*
* Compile like this:
* gcc -shared -fPIC -ldl -o libdropbox_ext4.so dropbox_ext4.c
*
* Run Dropbox like this:
* LD_PRELOAD=./libdropbox_ext4.so ~/.dropbox-dist/dropboxd
*/
@zzeroo
zzeroo / 256color.pl
Created December 18, 2018 21:49 — forked from hSATAC/256color.pl
256color.pl
#!/usr/bin/perl
# Author: Todd Larason <jtl@molehill.org>
# $XFree86: xc/programs/xterm/vttests/256colors2.pl,v 1.2 2002/03/26 01:46:43 dickey Exp $
# use the resources for colors 0-15 - usually more-or-less a
# reproduction of the standard ANSI colors, but possibly more
# pleasing shades
# colors 16-231 are a 6x6x6 color cube
for ($red = 0; $red < 6; $red++) {
@zzeroo
zzeroo / rocketguide.md
Created April 5, 2018 13:26 — forked from belst/rocketguide.md
Deploy Rocket in production

Deploy Rocket using Letsencrypt and nginx

Information

This guide uses the domain your-domain.tld and its www. prefixed version. It starts the rocket application on 127.0.0.1:1337 and as the user www-data. The proxy listens on port 80 and 443 though.
If you need other values, update them accordingly in your nginx and systemd configs.

Prerequisites

You need to have nginx, certbot and rust installed.

@zzeroo
zzeroo / shift_in.rs
Created April 18, 2016 10:31 — forked from anonymous/playground.rs
Shared via Rust Playground
#[derive(Debug,PartialEq)]
enum Bitorder {
LSBFIRST,
MSBFIRST,
}
fn main() {
let order: Bitorder = Bitorder::LSBFIRST;
if order == Bitorder::MSBFIRST {
@zzeroo
zzeroo / playground.rs
Created March 21, 2016 19:28 — forked from anonymous/playground.rs
Shared via Rust Playground
use std::collections::HashMap;
fn nucleotide_counts(nucleotides: &str) -> HashMap<char, usize> {
let mut nucleotide = HashMap::new();
for n in nucleotides.chars() {
let counter = nucleotide.entry(n) // gets the given key's corrosponding entry in the map for in-place manipulation
.or_insert(0); // ..or insert 0 if its not present already
*counter += 1; // Now increment the entry, so it's 1 for all new keys or plus one for all other.
}
nucleotide
@zzeroo
zzeroo / playground.rs
Created March 17, 2016 07:30 — forked from anonymous/playground.rs
Shared via Rust Playground
use std::collections::HashMap;
fn create_hashmap(strand_a: &str, strand_b: &str) -> HashMap<char, char> {
let strand_a: Vec<_> = strand_a.chars().collect();
let strand_b: Vec<_> = strand_b.chars().collect();
strand_a.iter().zip(strand_b.iter()).map(|(&a, &b)| (a, b)).collect()
}
fn main() {
@zzeroo
zzeroo / markdown.vim
Created October 15, 2012 05:55 — forked from natesilva/markdown.vim
Vim: Preview a Markdown document in the default browser on Windows or Mac OS X
"
" While editing a Markdown document in Vim, preview it in the
" default browser.
"
" Author: Nate Silva
"
" To install: Place markdown.vim in ~/.vim/ftplugin or
" %USERPROFILE%\vimfiles\ftplugin.
"
" To use: While editing a Markdown file, press ',p' (comma p)