Skip to content

Instantly share code, notes, and snippets.

View theoretick's full-sized avatar

Lucas Charles theoretick

View GitHub Profile
@sohaibbhatti
sohaibbhatti / respond_to.rb
Created November 11, 2012 16:27
code for how respond_to blocks are evaluated
def respond_to(*mimes, &block)
raise ArgumentError, "respond_to takes either types or a block, never both" if mimes.any? && block_given?
if collector = retrieve_collector_from_mimes(mimes, &block)
response = collector.response
response ? response.call : default_render({})
end
end
# File actionpack/lib/action_controller/metal/mime_responds.rb, line 267
@vosechu
vosechu / gist:4757887
Last active April 19, 2016 23:00
My Sublime config
{
"bold_folder_labels": true,
"caret_style": "wide",
"color_scheme": "Packages/User/SublimeLinter/Solarized (Light) (SL).tmTheme",
"detect_slow_plugins": false,
"dictionary": "Packages/Language - English/en_US.dic",
"draw_indent_guides": true,
"ensure_newline_at_eof_on_save": true,
"file_exclude_patterns":
[
@markandrus
markandrus / User.js
Last active May 3, 2016 16:38
Minimal User model for a Node.js project using JugglingDB, bcrypt, and Postgres. See something wrong with my salting and password hashing? Please let me know!
var Schema = require('jugglingdb').Schema,
bcrypt = require('bcrypt');
var schema = new Schema('postgres', { /* ... */ });
var User = schema.define('User', {
email: { type: String, length: 255 },
password: { type: String, length: 255 },
salt: { type: String, length: 255, default: bcrypt.genSaltSync(10) },
created: { type: Date, default: Date.now }
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active July 12, 2025 14:05
A badass list of frontend development resources I collected over time.
@jed
jed / how-to-set-up-stress-free-ssl-on-os-x.md
Last active February 27, 2025 16:31
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

@ejoubaud
ejoubaud / enable_sql_logs.rb
Created August 16, 2013 00:36
Rails: Enable SQL logs in debugger/pry/console
ActiveRecord::Base.logger = Logger.new(STDOUT)
@keichan34
keichan34 / active_record_marshalable.rb
Created September 5, 2013 11:33
Get Marshal.dump and Marshal.load to load cached association objects ( Whatever.includes(:example_models) ), as well.
module ActiveRecordMarshalable
def marshal_dump
[attributes, self.association_cache, instance_variable_get(:@new_record)]
end
def marshal_load data
send :initialize, data[0]
instance_variable_set :@association_cache, data[1]
instance_variable_set :@new_record, data[2]
end
@samg
samg / notes
Created October 23, 2013 16:33
Advanced Multithreading talk at Cascadia Ruby
Jerry D'Antonio
github.com/jdantonio (all code, slides, and notes in a repo on github)
@jerrydantonio
From Ohio
Works at a Ruby and Erlang shop.
@joegoggins
joegoggins / install and add gcc arm to PATH.sh
Last active October 2, 2024 14:24
How I installed GCC ARM on my Mac 10.9 Mac Book Pro
# Download the file manually from here https://launchpad.net/gcc-arm-embedded
# Note: `curl` command doesn't work
# I downloaded this one: "gcc-arm-none-eabi-4_7-2013q3-20130916-mac.tar.bz2"
# double click it to unzip it
# Make a place to install it to
mkdir /usr/local/gcc_arm
# Move the unzipped stuff there.

rage-quit plugin for oh-my-zsh

based on rage-quit support for bash

HOW TO INSTALL

Put the files below inside ~/.oh-my-zsh/custom/plugins/fuck

Also chmod a+x the flip command.