Skip to content

Instantly share code, notes, and snippets.

View ericalli's full-sized avatar
🎯
Focusing on @getsiimple

Eric Alli ericalli

🎯
Focusing on @getsiimple
View GitHub Profile
@ericalli
ericalli / USER_AUTH_RAILS_EXAMPLE.md
Created May 24, 2020 08:14 — forked from mdang/USER_AUTH_RAILS_EXAMPLE.md
Lesson: User Auth (Rails Example)

User Auth with Rails (The Fun Way)

Starting a new project

$ rails new user_auth --database=postgresql
$ cd user_auth
@ericalli
ericalli / user_association.rb
Created May 24, 2020 08:12
Adding User Association to Any Table
rails generate migration AddUserRefToProducts user:references
class AddUserRefToProducts < ActiveRecord::Migration[6.0]
def change
add_reference :products, :user, foreign_key: true
end
end
# MyApp/app/controllers/products_controller.rb
<script>
// Custom configration for Dandelion theme
var themeConfig = {
// The API key for your Ghost blog
ghostSearchKey: 'xxxx',
// Custom taglines for the 'Subscribe' section of your homepage (if subscribers are enabled), comma separated
newsletterTaglines: ['My first tagline', 'My second tagline', 'My third tagline'],
// Your disqus username (leave blank for no comments)
@ericalli
ericalli / wp.sh
Created July 12, 2017 05:06 — forked from bgallagh3r/wp.sh
Wordpress: Bash Install Script -- Downloads latest WP version, updates wp-config with user supplied DB name, username and password, creates and CHMOD's uploads dir, copies all the files into the root dir you run the script from, then deletes itself!
#!/bin/bash -e
clear
echo "============================================"
echo "WordPress Install Script"
echo "============================================"
echo "Database Name: "
read -e dbname
echo "Database User: "
read -e dbuser
echo "Database Password: "
public function check_cache() {
$group_handles = array();
foreach ( $this->queue as $group => $assets ) {
$group_handles[] = $this->get_concatenated_filename( $group );
}
$cache_dir = trailingslashit( $this->cache_dir );
if ( is_dir( $cache_dir ) ) {
function file_get_contents_curl($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Set curl to return the data instead of printing it to the browser.
curl_setopt($ch, CURLOPT_URL, $url);
$data = curl_exec($ch);
curl_close($ch);
[column size="two_third" is_last="false"]
[t2t_slitslider posts_to_show="-1" width="fixed" autoplay="false" interval="5" controls_color="dark"]
[/column]
[column size="one_third" is_last="true"]
IMAGE GOES HERE
var images = [
{
"726":['photo5.jpeg','photo6.jpeg']
},
{
"768":['photo2.png','photo3.png','photo4.png','photo3.png','photo1.png']
}
];
div.tabs ul.ui-tabs-nav li.ui-state-active a { padding-bottom: 26px; }
div.tabs ul.ui-tabs-nav li a { padding: 25px 50px 25px 50px; }
<% if @facility.has_admin(@current_user) %>
<div id="profile_link" class="box">
<div class="title">
<h4>
<%= icon_tag "link" %>
Share Facility
</h4>
</div>
<div class="content">
<span><input type="radio" name="link_type" class="checkbox" value="link" checked="checked" data-value="<%= facility_url(@facility) %>" /> Facility Link</span>