Skip to content

Instantly share code, notes, and snippets.

View QuintinAdam's full-sized avatar
:shipit:

Quintin Adam QuintinAdam

:shipit:
  • Wayfinder
  • Japan
View GitHub Profile
@chris-gooley
chris-gooley / _materializecss-rails-confirm.coffee
Last active May 1, 2018 12:55 — forked from dannyvassallo/_materializecss-rails-confirm.coffee
Replace Rails 4 confirmation/prompts with a toast message from Dogfalo Materialize CSS. Regular repo - https://github.com/Dogfalo/materialize Sass Gem - https://github.com/mkhairi/materialize-sass Website - http://materializecss.com/
$ ->
$.rails.allowAction = (link) ->
return true unless link.attr("data-confirm")
$.rails.showConfirmDialog link
false
$.rails.confirmed = (link) ->
link.removeAttr "data-confirm"
link[0].click() # force click on element directly
@nateberkopec
nateberkopec / 0.result.md
Last active January 18, 2024 11:20 — forked from tomfuertes/0.result.md
De-'Async Inject'ing Universal Analytics

De-'Async Inject' Universal Analytics

This gist applies the theory from Ilya Grigorik's Script-injected "async scripts" considered harmful on the default Universal Analytics snippet. TLDR place this above the CSS in the <head> of your document

<!-- Google Analytics Part 1: Creates window.ga, sets account, and queues pageview-->
<script>
  !function(n,t){n.GoogleAnalyticsObject=t,n[t]=n[t]||function(){(n[t].q=n[t].q||[]).push(arguments)},n[t].l=1*new Date}(window,"ga");
  ga('create', 'UA-XXXX-Y', 'auto'); // REPLACE UA-XXXX-Y w/ YOUR ACCOUNT
 ga('send', 'pageview');
@kpheasey
kpheasey / 0000_packages.config
Last active September 16, 2019 21:56 — forked from gcarrion-gfrmedia/0000_packages.config
AWS Elastic Beanstalk Ruby 2.2 Puma Sidekiq
packages:
yum:
git: []
htop: []
@mediasota
mediasota / gist:7c46c8e105acc386d62f
Created March 6, 2015 12:04
config/initializers/simple_form_materialize-sass.rb
# Use this setup block to configure all options available in SimpleForm.
SimpleForm.setup do |config|
config.error_notification_class = 'alert alert-danger'
config.button_class = 'waves-effect waves-light btn'
config.boolean_label_class = nil
config.wrappers :vertical_form, tag: 'div', class: 'input-field', error_class: 'has-error' do |b|
b.use :html5
b.use :placeholder
b.optional :maxlength
# admin/seo/_seo_form.html.erb
<div class='full-inputs'>
<%= simple_form_for seo, remote: true, url: admin_update_seo_path(seo) do |f| %>
<%= f.input :content, required: true, as: :text, input_html: {rows: 2, maxlength: "#{ seo.name == 'title' ? '70' : '155' }"}, label: seo.name.try(:humanize), hint: "<span class='character-count green'> </span> #{seo.name.try(:humanize)} should be no longer than #{ seo.name == 'title' ? '70' : '155' } characters" %>
<div class='text-center'>
<button class='btn btn-primary'>Update</button>
<a href="#<%= page %>" class='cancel-seo btn btn-warning' data-attribute="<%=f.object.id %>"> Cancel</a>
<% end %>
# ...
<%= domain_stylesheet_link_tag "application", media: "all" %>
<%= domain_javascript_include_tag "application" %>
#...
@emad-elsaid
emad-elsaid / moving-line.rb
Created March 26, 2014 13:31
Draw a Moving line with mouse using Ruby and Gosu gem
#!/usr/bin/env ruby
# Author : Emad Elsaid (https://github.com/blazeeboy)
require 'gosu'
include Gosu
$dimension = 200
$line_limit = 70
class GameWindow < Window
@emad-elsaid
emad-elsaid / matrix.rb
Created March 16, 2014 14:28
Create Matrix Like screen using Ruby
#!/usr/bin/env ruby
require 'gosu' # gem install gosu
$width, $height = 200, 200
$number_of_v_lines,$number_of_h_lines = 10, 10
$chars = ('a'..'z').to_a
class Entity
def initialize(x,y,vel, win)
@pos, @vel = {x:x, y:y}, vel
@emad-elsaid
emad-elsaid / markdown.rb
Created March 9, 2014 11:35
Everytime i write markdown and commit i find error, so i solved the problem ;)
#!/usr/bin/env ruby
# gem install sinatra --no-document
# gem install github-markdown --no-document
require 'sinatra'
require 'github/markdown'
set :port, 3000
get '/' do
<<-EOT
<!DOCTYPE html>
@CodyStringham
CodyStringham / killing sessions.md
Last active August 29, 2015 13:56
Postgres Restart

####Killing Sessions

ps aux | grep postgres
kill -9 process-number

-9 is dangerous, will force kill

####PG Restart

ps aux | grep postgres