This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
validate :test | |
def test | |
unless column.nil? | |
...do your test... | |
end | |
return true | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// simple interface expecting data from serial | |
// provided by ardy.rb | |
// | |
// pin states: | |
// 48 = ok | |
// 49 = bad | |
// | |
// originated by mike heijmans | |
int ledPin = 13; // which pin do I control? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'json' | |
ARGV.each do |file| | |
begin | |
JSON.parse(File.open(file).read) | |
puts "you're good! :: #{file}" | |
rescue | |
puts "FAIL! :: #{file}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
free_data="$(free)" | |
mem_data="$(echo "$free_data" | grep 'Mem:')" | |
free_mem="$(echo "$mem_data" | awk '{print $4}')" | |
buffers="$(echo "$mem_data" | awk '{print $6}')" | |
cache="$(echo "$mem_data" | awk '{print $7}')" | |
total_free=$((free_mem + buffers + cache)) | |
used_swap="$(echo "$free_data" | grep 'Swap:' | awk '{print $3}')" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env ruby | |
require 'thread' | |
# Set the process name | |
$0 = 'jekyll_dev' | |
# Environment | |
ENV['JEKYLL_WITH_DRAFTS'] ||= 'true' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"tab_size": 2, | |
"translate_tabs_to_spaces": true, | |
"ensure_newline_at_eof_on_save": true | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias rebase!="git rebase -i `git merge-base \`git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'\` master`" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"tab_size": 2, | |
"translate_tabs_to_spaces": true, | |
"color_scheme": "Packages/User/Colorsublime/themes/Merbivore.tmTheme", | |
"ensure_newline_at_eof_on_save": true, | |
"trim_trailing_white_space_on_save": true, | |
"rulers": | |
[ | |
80, | |
120 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'httparty' | |
hipchat_token = ENV['HIPCHAT_TOKEN'] | |
hipchat_email = ENV['HIPCHAT_EMAIL'] | |
hipchat_api = ENV['HIPCHAT_API'] || 'api.hipchat.com' | |
url = "https://#{hipchat_api}/v2/user/#{hipchat_email}?auth_token=#{hipchat_token}" | |
user = JSON.parse HTTParty.get(url).body |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Find a SIX digit number in which the FIRST digit is ONE more than the THIRD, | |
# the SECOND digit is ONE less than the FOURTH, the FIFTH digit is ONE less than | |
# the THIRD, and the SIXTH digit is ONE more than the FOURTH. The sum of the | |
# SECOND and THIRD digits equal the FIRST. The sum of all digits is 30. | |
# Returns 6 digit numbers that the sum of the digits are 30 | |
def possible_numbers | |
numbers = [] |