Skip to content

Instantly share code, notes, and snippets.


Sia siakaramalegos

View GitHub Profile
BideoWego / Searchable.rb
Last active Jul 9, 2018
Model Searchable concern for Rails
View Searchable.rb
module Searchable
def self.included(base)
module ClassMethods
@@searchable_fields = []
@@searchable_scope = nil
def search(q, method=nil)
Restuta /
Last active Jan 21, 2022
Sizes of JS frameworks, just minified + minified and gzipped, (React, Angular 2, Vue, Ember)

Below is the list of modern JS frameworks and almost frameworks – React, Vue, Angular, Ember and others.

All files were downloaded from and named accordingly. Output from ls command is stripped out (irrelevant stuff)

As-is (minified)

$ ls -lhS
566K Jan  4 22:03 angular2.min.js
jwill / MemeMaker.html
Last active Jul 15, 2021
Starter code for Meme Maker
View MemeMaker.html
<!DOCTYPE html>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
eriktrautman / sublime_text_2_preferences
Last active Jan 12, 2018
Sublime Text 2 User Preferences
View sublime_text_2_preferences
// These settings can be found under Sublime Text 2 >> Preferences >> Settings - User
// You can just copy-paste this file right over whatever was there if you want
// Check out the file at Sublime Text 2 >> Preferences >> Settings - Default
// to see what options are available for you
"color_scheme": "Packages/Color Scheme - Default/LAZY.tmTheme",
"font_size": 14.0,
kyletcarlson / json_response_handling_ruby.rb
Created Dec 11, 2013
Ruby script that uses open-uri to fetch the contents of a JSON endpoint, uses the JSON gem to parse the string into a Ruby array & prints some of the records. This is the foundation for all web API requests, so feel free to use it in the future.
View json_response_handling_ruby.rb
require 'open-uri'
require 'json'
require 'pp'
# Construct the URL we'll be calling
request_uri = 'http://localhost:3000/users.json'
request_query = ''
jwo / secret_controller.rb
Created Nov 5, 2013
Devise testing controllers - minitest / rails4
View secret_controller.rb
class SecretController < ApplicationController
before_filter :authenticate_user!
def show
mperham / after.rb
Created Jul 4, 2012
Thread-friendly shared connection
View after.rb
class ActiveRecord::Base
mattr_accessor :shared_connection
@@shared_connection = nil
def self.connection
@@shared_connection || => 1) { retrieve_connection }
ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection
them0nk / rspec_rails_cheetsheet.rb
Created Mar 23, 2012
Rspec Rails cheatsheet (include capybara matchers)
View rspec_rails_cheetsheet.rb
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
response.should render_template(:index)
response.should redirect_to(movies_path)
View slugify.js
function slugify(text)
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
View capybara cheat sheet
=Clicking links and buttons=
click_link('Link Text')
click('Link Text') # Click either a link or a button
click('Button Value')