Skip to content

Instantly share code, notes, and snippets.

@StarWar
StarWar / ssl_puma.sh
Created October 8, 2021 09:34 — forked from tadast/ssl_puma.sh
localhost SSL with puma
# 1) Create your private key (any password will do, we remove it below)
$ cd ~/.ssh
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@StarWar
StarWar / firestore.rules
Created September 30, 2021 15:11 — forked from felipepastorelima/firestore.rules
Firestore Rules utilities to reduce verbosity. Generator: https://scaffoldhub.io/firestore-rules
service cloud.firestore {
match /databases/{database}/documents {
// START - Usage example
match /people/{document=**} {
function propertiesValid() {
return request.resource.data.keys().hasAll(['name', 'birthdate', 'yearsOfExperience'])
&& request.resource.data.size() == 3
&& isString('name') && minlength('name', 3) && maxlength('name', 255)
@StarWar
StarWar / Confirm.vue
Created April 10, 2020 07:14 — forked from eolant/Confirm.vue
Vuetify Confirm Dialog component that can be used locally or globally
<template>
<v-dialog v-model="dialog" :max-width="options.width" :style="{ zIndex: options.zIndex }" @keydown.esc="cancel">
<v-card>
<v-toolbar dark :color="options.color" dense flat>
<v-toolbar-title class="white--text">{{ title }}</v-toolbar-title>
</v-toolbar>
<v-card-text v-show="!!message" class="pa-4">{{ message }}</v-card-text>
<v-card-actions class="pt-0">
<v-spacer></v-spacer>
<v-btn color="primary darken-1" text @click.native="agree">Yes</v-btn>
@StarWar
StarWar / media-query.css
Created April 7, 2019 06:08 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
@StarWar
StarWar / environment.js
Created December 25, 2018 14:28 — forked from nerdcave/environment.js
PurgeCSS config for Rails 5 and Webpacker (along with Tailwind CSS and Vue.js, in this case)
// first run:
// yarn add glob-all purgecss-webpack-plugin --dev
/*
config/webpack/environment.js
PurgeCSS configuration for Rails 5 + Webpacker + Tailwind CSS + Vue.js
Optionally, put this in production.js if you only want this to apply to production.
For example, your app is large and you want to optimize dev compilation speed.
*/
@StarWar
StarWar / fibonacci.ex
Created October 29, 2018 12:36 — forked from dhc02/fibonacci.ex
Fibonacci sequence in Elixir
defmodule Fibonacci do
def find(nth) do
list = [1, 1]
fib(list, nth)
end
def fib(list, 2) do
Enum.reverse(list)
end
@StarWar
StarWar / pg_import_csv_to_heroku.sh
Created August 31, 2018 15:36 — forked from jboesch/pg_import_csv_to_heroku.sh
Importing a CSV dump of Postgres data into Heroku
# You have your csv data and it looks like so... It's in a file named "my_data.csv" and we want to import it into a table named "my_things".
"1", "Something", "0.50", "2013-05-05 10:00:00"
"2", "Another thing", "1.50", "2013-06-05 10:30:00"
# Now you want to import it, go to the command line and type:
$ PGPASSWORD=PWHERE psql -h HOSTHERE -U USERHERE DBNAMEHERE -c "\copy my_things FROM 'my_data.csv' WITH CSV;"
# Voila! It's impoted. Now if you want to wipe it out and import a fresh one, you would do this:
@StarWar
StarWar / get-first-image.php
Created March 14, 2018 14:52 — forked from tommaitland/get-first-image.php
WordPress helper function that retrieves the first image from a post, with basic support for swapping the image size.
<?php
/*
Based on the original CSS-Tricks code (http://css-tricks.com/snippets/wordpress/get-the-first-image-from-a-post/)
## Usage
Include in functions.php
<?php echo get_first_image('thumbnail'); ?>
@StarWar
StarWar / embedded-file-viewer.md
Created January 3, 2018 15:32 — forked from tzmartin/embedded-file-viewer.md
Embedded File Viewer: Google Drive, OneDrive

Office Web Apps Viewer

('.ppt' '.pptx' '.doc', '.docx', '.xls', '.xlsx')

http://view.officeapps.live.com/op/view.aspx?src=[OFFICE_FILE_URL]

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=[OFFICE_FILE_URL]' width='px' height='px' frameborder='0'>
</iframe>

OneDrive Embed Links

@StarWar
StarWar / citations
Created December 29, 2017 16:33 — forked from bussiere/citations
citations quote informatic informatique quotes computer science
“The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.” – Tom Cargill
“In order to understand recursion, one must first understand recursion.” – Author Unknown
“I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone.” – Bjarne Stroustrup
“A computer lets you make more mistakes faster than any other invention in human history, with the possible exceptions of handguns and tequila.” – Mitch Ratcliffe
“There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.” -C.A.R. Hoare
“The gap between theory and practice is not as wide in theory as it is in practice.” – Author Unknown
“If builders built buildings the way progra