Skip to content

Instantly share code, notes, and snippets.

View stevenspiel's full-sized avatar

Steven Spiel stevenspiel

View GitHub Profile
@stevenspiel
stevenspiel / example.dart
Created February 26, 2022 22:04
DraggableScrollableSheet example
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
Verifying my Blockstack ID is secured with the address 1EEQfALCUFNQ6EYMPx2KfytxgdVTtJbAZd https://explorer.blockstack.org/address/1EEQfALCUFNQ6EYMPx2KfytxgdVTtJbAZd
@stevenspiel
stevenspiel / paper_trail_spec.rb
Last active March 30, 2016 20:03
Tests that all ActiveRecord models are using paper_trail. It finds all classes that inherit from ActiveRecord::Base and checks to see if :paper_trail_options is defined on each one.
require 'rails_helper'
describe 'paper_trail' do
before { Rails.application.eager_load! }
let(:excluded_classes) { [ActiveRecord::SchemaMigration, PaperTrail::Version, PaperTrail::VersionAssociation] }
let(:models) { ActiveRecord::Base.descendants - excluded_classes }
it 'is implemented in all ActiveRecord::Base models' do
expect(models).to all(respond_to(:paper_trail_options))
end
@stevenspiel
stevenspiel / rails_confirm_override.js.coffee
Last active January 25, 2016 12:46
Replace Rails confirm with sweetalert2 popup. (https://github.com/limonte/sweetalert2). It overrides the default javascript (from jquery_ujs), which skips any other popup.
# Override the default confirm dialog by rails
$.rails.allowAction = (link) ->
if link.data('confirm')
$.rails.showConfirmationDialog(link)
false
else
true
# User click confirm button
$.rails.confirmed = (link) ->
@stevenspiel
stevenspiel / ie8_node_enum.js
Last active August 29, 2015 14:14
mixins for formbuilder
var Node = Node || {
ELEMENT_NODE: 1,
ATTRIBUTE_NODE: 2,
TEXT_NODE: 3
};
@stevenspiel
stevenspiel / site.rb
Created April 10, 2014 16:12
Fix to HTTP 400 Bad Request when running librarian-chef install
#File found in ruby/gems/(ruby version)/gems/librarian-chef-0.0.2/lib/librarian/chef/source/site.rb
require 'fileutils'
require 'pathname'
require 'uri'
require 'net/http'
require 'json'
require 'digest'
require 'zlib'
require 'securerandom'
@stevenspiel
stevenspiel / .DS_Store
Last active August 29, 2015 13:56 — forked from ksolo/carousel.js
Image Carousel
@stevenspiel
stevenspiel / form-validator.js
Last active August 29, 2015 13:56 — forked from ksolo/form-validator.js
Form Validation
$(function(){
$('#submit').click(function(e){
e.preventDefault();
var errors = [];
if(!$('#email').val().match(/^[+a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/i) ){
errors.push("<li>Must be a valid email address </li>");
}
if(!$('#password').val().match(/[0-9]+?/)){
errors.push("<li>Password must have at least one numeric character (0-9)</li>");
}
@stevenspiel
stevenspiel / zoo.js
Last active August 29, 2015 13:56 — forked from dbc-challenges/zoo.js
//------------------------------------------------------------------------------------------------------------------
// YOUR CODE: Create your Zoo "object literal" and Animal "constructor" and "prototypes" here.
//------------------------------------------------------------------------------------------------------------------
function Animal(name, legs){
this.name = name;
this.legs = legs;
}
Animal.prototype.identify = function(){
"I am a " + this.name + " with " + this.legs + " legs";
@stevenspiel
stevenspiel / .DS_Store
Last active August 29, 2015 13:56 — forked from dbc-challenges/index.html
DBC Phase 2 Practice Assessment Part 3