Skip to content

Instantly share code, notes, and snippets.

View cdesch's full-sized avatar
🏠
Working from home

cdesch cdesch

🏠
Working from home
View GitHub Profile
@chip
chip / find-unused.sh
Created December 23, 2013 19:13
This helps me find unused images in a Rails project. The echo statement never executes, so there's a glitch, but the output was helpful nonetheless. I'll try to improve later.
#!/bin/sh
PROJECT="" # Fill this in
IMAGES="$PROJECT/app/assets/images"
VIEWS="$PROJECT/app/views"
CSS="$PROJECT/app/assets/stylesheets"
for image in `find $IMAGES -type f`
do
name=`basename $image`
@itskingori
itskingori / application_controller.rb
Last active March 4, 2024 09:07 — forked from speed-of-light/application_controller.rb
How to handle exceptions like 401, 501, 404 in Rails
# As used with CanCan and Devise
class ApplicationController < ActionController::Base
protect_from_forgery
include ErrorResponseActions
rescue_from CanCan::AccessDenied, :with => :authorization_error
rescue_from ActiveRecord::RecordNotFound, :with => :resource_not_found
before_filter :authenticate!
@wboykinm
wboykinm / cr-leaflet.js
Last active May 2, 2018 19:22
Census reporter GeoJSON tiles
CensusReporter = {
GeoIDLayer: L.GeoJSON.extend({
addGeoID: function(geoid) {
var request = new XMLHttpRequest();
var url = this.options.api_url + "/1.0/geo/show/tiger2013?geo_ids=" + geoid;
request.open('GET', url, true);
var self = this;
request.onreadystatechange = function() {
if (this.readyState === 4) {
if (this.status >= 200 && this.status < 400) {
@olih
olih / jq-cheetsheet.md
Last active May 3, 2024 17:42
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

@maxivak
maxivak / _readme.md
Last active March 6, 2024 17:57
Building URLs for simple_form - all examples. Rails

Namespace

Namespace and simple_form

  • namespace 'admin'
= simple_form_for([:admin,@item], html: { class: 'form-horizontal' }) do |f|
    
@binary1230
binary1230 / wells fargo website bulk statement downloader
Last active November 14, 2023 02:22
wells fargo ability to download all bank statements
3/18/2021: WE HAVE MOVED: For the latest instructions on how to use the bulk wells fargo PDF downloader,
please ignore this page and visit below:
https://github.com/binary1230/wellsfargo-bulk-PDF-statement-downloader/blob/main/README.md
@jacobtomlinson
jacobtomlinson / .gitignore_global
Created August 18, 2017 10:08
An example global gitignore file
# An example global gitignore file
#
# Place a copy if this at ~/.gitignore_global
# Run `git config --global core.excludesfile ~/.gitignore_global`
# Compiled source #
###################
*.com
*.class
*.dll
@sydneyitguy
sydneyitguy / eth.rb
Created January 8, 2020 16:42
Ethereum address validation and normalization in Ruby
# Extracted from https://github.com/se3000/ruby-eth
#
# Dependencies:
# - gem 'digest-sha3'
# - gem 'rlp'
#
# Usage:
# - Eth::Utils.valid_address?('0x4Db7569F90bd836294B11c8b08B853d2de499Ced')
# => true
# - Eth::Utils.format_address('0x4db7569f90bd836294b11c8b08b853d2de499ced')
@Paraphraser
Paraphraser / Checking your Raspberry Pi's view of its power supply.md
Created June 13, 2022 06:53
Checking your Raspberry Pi's view of its power supply (sometimes it's not the wall-wart)

Checking your Raspberry Pi's view of its power supply

Sometimes it seems like the first (and sometimes only) advice you get offered for almost any problem with a Raspberry Pi is "check your power supply". You think something like:

"hey, I'm using an official power supply sold as being matched with my Pi so how can there be any problem?"

You look up the specs then stick a controlled load across your supply and confirm that it can deliver the required number of Watts.

Yet your problems persist…

@MihailCosmin
MihailCosmin / cuda_11.8_installation_on_Ubuntu_22.04
Last active May 2, 2024 12:46 — forked from primus852/cuda_11.7_installation_on_Ubuntu_22.04
Instructions for CUDA v11.8 and cuDNN 8.7 installation on Ubuntu 22.04 for PyTorch 2.0.0
#!/bin/bash
### steps ####
# verify the system has a cuda-capable gpu
# download and install the nvidia cuda toolkit and cudnn
# setup environmental variables
# verify the installation
###
### to verify your gpu is cuda enable check