Skip to content

Instantly share code, notes, and snippets.

View kidbombay's full-sized avatar

Ketan Anjaria kidbombay

View GitHub Profile
@wbednarski
wbednarski / rename_phoenix_project.sh
Last active March 22, 2024 07:04 — forked from krystofbe/rename_phoenix_project.sh
rename a phoenix 1.3 project
#!/bin/bash
set -e
CURRENT_NAME="Zauberantrag"
CURRENT_OTP="zauberantrag"
NEW_NAME="Wunderantrag"
NEW_OTP="wunderantrag"
@hl
hl / context.ex
Last active August 28, 2021 04:55
defmodule Context do
@moduledoc false
defmacro __using__(opts) do
repo = Keyword.fetch!(opts, :repo)
quote do
import Context, only: [context: 1, context: 2]
Module.put_attribute(__MODULE__, :__repo__, unquote(repo))
@digitallysavvy
digitallysavvy / .js
Last active December 6, 2021 04:18
The basic JS code for group video chat using Agora.io
// app / channel settings
var agoraAppId = ""; // Set your Agora App ID
var channelName = 'agora-web-docs-demo';
// video profile settings
var cameraVideoProfile = '480_4'; // 640 × 480 @ 30fps & 750kbs
var screenVideoProfile = '480_2'; // 640 × 480 @ 30fps
// create client instances for camera (client) and screen share (screenClient)
@DaleMckeown
DaleMckeown / select2-bootstrap-v4.0.0-alpha.6.scss
Last active July 21, 2017 08:52
Modification of judetucker's select2-bootstrap-v4.0.0-alpha.6.scss to fix Bootstrap border-radius issue. This uses the Bootstrap border-radius mixin to ensure $enable-rounded is honored.
//
// Mixins - we need to override the Bootstrap mixins to set border-radius to 0 if $enable-rounded is false.
// --------------------------------------------------
@mixin border-radius($radius: $border-radius) {
@if $enable-rounded {
border-radius: $radius;
}
@else {
@mbenatti
mbenatti / 0-font-awesome-bootstap-phoenix.md
Last active February 2, 2024 14:59
Installing Bootstrap 4 + Font Awesome from NPM in Phoenix Framework using sass
  • Tested with Phoenix 1.3

1) Installing sass, font-awesome and bootstrap package's using Brunch

First, install the Sass, Font Awesome, bootstrap(and deps) package:

cd assets

  • npm install --save-dev sass-brunch
  • npm install --save font-awesome
@judetucker
judetucker / select2-boostrap-v4-alpha-6.scss
Created April 6, 2017 22:29
Select2 Boostrap 4 Stylesheet
//
// Variables
// --------------------------------------------------
// Variables directly translating Bootstrap variables
// -------------------------
$s2bs-border-radius-base: $border-radius !default;
$s2bs-border-radius-large: $border-radius-lg !default;
$s2bs-border-radius-small: $border-radius-sm !default;
@angel-vladov
angel-vladov / select2-bootstrap4.after.scss
Last active March 16, 2018 16:01
Select2 for Bootstrap4
// Import this file after select2 bootstrap theme. Content won't be centered if you don't include this file.
.select2-container--bootstrap {
.select2-selection--multiple {
.select2-selection__choice {
margin-top: calc(#{$s2bs-padding-base-vertical} - 1px);
}
.select2-search--inline .select2-search__field {
height: $s2bs-input-height-base;
}

The Complete Guide to Nested Forms in Phoenix

I recently spent some time dealing with nested forms in Phoenix. Nested forms are great when you want to create multiple database records in a single transaction and associate them with each other. I am new to Phoenix and really struggled to find any resources that helped me with my specific problem. I decided to document what I learned in the process in hopes of helping others that are new to Elixir and Phoenix.

Here is my attempt at a one stop shop to learn everything you will need to know about nested forms. If you would like to view the GitHub repo you can check it out here.

Thanks to Heartbeat and Jose for excellent blog posts on nested forms. Also shoutout to Josh for showing me some examples at Ruby

@maxdbn
maxdbn / sidekiq.config
Last active May 23, 2021 12:05
Gracefully restarting Sidekiq on Elasticbeanstalk, only after it's done with the running jobs. Tested on: 64bit Amazon Linux 2016.09 v2.3.0 running Ruby 2.3 (Puma). Thanks to ssaunier for the original gist! https://gist.github.com/ssaunier/44bbebb9c0fa01953860
# Sidekiq interaction and startup script
commands:
create_post_dir:
command: "mkdir -p /opt/elasticbeanstalk/hooks/appdeploy/post"
ignoreErrors: true
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/50_restart_sidekiq.sh":
mode: "000755"
owner: root
group: root
@jlxw
jlxw / index.html
Created October 7, 2016 02:51
Parsley 2.5 and Bootstrap 4
<script src='https://cdnjs.cloudflare.com/ajax/libs/parsley.js/2.5.0/parsley.min.js'></script>
<script>
Parsley.options.errorClass = 'has-danger'
Parsley.options.successClass = 'has-success'
Parsley.options.classHandler = function(f) { return f.$element.closest('.form-group'); }
Parsley.options.errorsWrapper = '<div class="form-control-feedback"></div>'
Parsley.options.errorTemplate = '<div></div>'
</script>