Skip to content

Instantly share code, notes, and snippets.

advorak

Block or report user

Report or block advorak

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View routes.rb
resource 'definitions'
%w(flashcards multichoice type).each do |name|
get name, to: "definitions##{name}"
### I want to define a 'get' resource within definitions from within here...
end
#resource 'definitions' do
# get 'flashcards'
#end
@advorak
advorak / appify.sh
Created Nov 29, 2011 — forked from mathiasbynens/appify
appify — create the simplest possible Mac app from a shell script (adds an application icon)
View appify.sh
#!/bin/bash
if [ "$1" = "-h" -o "$1" = "--help" ]; then cat <<EOF
appify v3.0.0 for Mac OS X - http://mths.be/appify
Creates the simplest possible Mac app from a shell script.
Appify takes a shell script as its first argument:
`basename "$0"` my-script.sh
View cylinder.scad
//I want the larger end of this object:
translate([-73,0,0]) rotate([0,90,0]) cylinder(h=73, d1=16, d2=0, center=false, $fn=100);
// to resemble the corresponding end of this object:
intersection() {
translate([-73+16/2,0,0]) {
difference() { cylinder(h=16, d1=16, d2=16); translate([0,-10,0]) cube(73,16,16); }
}
translate([-73,0,0]) rotate([0,90,0]) cylinder(h=73, d1=16, d2=0, center=false, $fn=100);
View MacBook Pro_copy_to.rb
require 'fileutils'
floppy_location = '/Volumes/floppy'
files = Dir['/tmp/Mac OS 8.1/*.img.*']
files.each do |file|
puts "#{Time.now}:\t#{file}"
# Wait until floppy is mounted...
until File.exists?(floppy_location) do
View 1_regex-problem.js
var data = `
OUT: 1111
OUT: andy
OUT: 121 OUT: 1324
NOTOUT: 1114
IN: 144`;
@advorak
advorak / spi_shift_register.c
Created Sep 3, 2016
...trying to figure out why the variable 'andy' on line 79 is sent as 10111010 even though the shift register has set 10111011.. is this a problem with an extra bit shifting the register over? ...is this a problem with MSB/LSB? </lost>
View spi_shift_register.c
#include <avr/io.h> //Include the headers that handles Input/Output function for AVR chips
#include "spi_shift_register.h"
#include <util/delay.h> //Include the headers that allow for a delay function
#include <avr/interrupt.h>
#include <inttypes.h>
#include <util/setbaud.h>
//#include <stdlib.h>
//#include <string.h>
#include <stdio.h>
View bits.rb
starting_point = 0b11011101
ending_point = 0b10111001
bits_to_change = starting_point ^ ending_point #=> "0b01100100"
on_bits = ending_point & bits_to_change #=> "0b00100000"
off_bits = starting_point & bits_to_change#=> "0b01000100"
@advorak
advorak / toggle_led_bitmath.c
Created Aug 25, 2016
Uses bitmath to assess an 8 bit register of switches and notes any recently-depressed switches to toggle LED lights on a separate register of 8 bits...
View toggle_led_bitmath.c
/*
* toggle_led_bitmath.c
* Description: Uses bitmath to assess an 8 bit register of switches
* and notes any recently-depressed switches to toggle
* LED lights on a separate register of 8 bits...
*/
#define F_CPU 16000000UL //Define the speed the clock is running at. Used for the delay.h functions
#include <avr/io.h> //Include the headers that handles Input/Output function for AVR chips
View new_code.rb
my_page_data = @pages.collect(&:to_s)
my_signed_on_data = my_page_data.group_by{|t| t.match /((?:[A-Z]|-| )+EXTRA BOARD|BLK|RUN)/;$1.strip unless $1.nil?}.reject{|k,v| k.nil?}
my_signed_on_data.inject({}) do |memo,obj|
obj[1] = obj[1].join "\n"
obj[1] = case obj[0]
when "BLK"
obj[1].scan(/^\s*((?:(?:C|M)_)?\d{4})\s+\|(.*?)\|(.*?)\|(.*?)\|(.*?)\|(.*?)\|(.*?)\|(.*?)\|(.*?)\|(.*?)\|.*?\$(\d{4}\.\d{2})\s*\$(\d{4}\.\d{2})/).collect{|blks| Hash[[[:block_number, :saturday, :sunday, :monday, :tuesday, :wednesday, :thursday, :friday, :cap_id, :name, :bi_weekly_pay_school, :bi_weekly_pay_non_school],blks].transpose]}
when "RUN"
View gist:5816191
// I have a bunch of inputs[type=text] that contains the following ids: #name, #address, #city, #state, #zipcode
// $current will be set to the input#name field.
$current = $('input#name')
// I want to select all $('input') but omit the $current .. how can I do this?
$('input')
You can’t perform that action at this time.