clarified butter
- GitHub Staff
- http://jonmagic.com/
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
class Email < ActiveRecord::Base | |
# Nope, it's not RFC compliant. F*** that regex. | |
# http://www.ex-parrot.com/~pdw/Mail-RFC822-Address.html | |
EmailRegex = /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i.freeze | |
before_validation :strip_spaces | |
# Public: The email address. | |
# column :address |
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
class Song | |
include MongoMapper::Document | |
plugin Grip | |
attachment :mp3 | |
key :title, String | |
key :artist, String | |
key :album, String | |
key :genre, String |
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 "benchmark" | |
require "delegate" | |
require "forwardable" | |
class Person | |
def initialize(name, ip) | |
@name = name | |
@ip = ip | |
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
class Reputation | |
class Error < StandardError; end | |
def initialize(sample_size:, not_spammy_sample_size:) | |
@sample_size = sample_size | |
@not_spammy_sample_size = not_spammy_sample_size | |
end | |
attr_reader :sample_size | |
attr_reader :not_spammy_sample_size |
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
#include <math.h> | |
int BUTTON = D0; | |
int GREEN_LED = D1; | |
int RED_LED = A4; | |
int buttonState = 0; | |
// Takes the current hour (0-23) and multiplies it by 60 (minutes) and then | |
// adds the minutes after the hour (0-59. |
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
# List unique values in a DataFrame column | |
# h/t @makmanalp for the updated syntax! | |
df['Column Name'].unique() | |
# Convert Series datatype to numeric (will error if column has non-numeric values) | |
# h/t @makmanalp | |
pd.to_numeric(df['Column Name']) | |
# Convert Series datatype to numeric, changing non-numeric values to NaN | |
# h/t @makmanalp for the updated syntax! |
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
/*********************************** | |
This is our GPS library | |
Adafruit invests time and resources providing this open source code, | |
please support Adafruit and open-source hardware by purchasing | |
products from Adafruit! | |
Written by Limor Fried/Ladyada for Adafruit Industries. | |
BSD license, check license.txt for more information | |
All text above must be included in any redistribution |
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
$> brew cask install java | |
$> brew install kafka | |
$> vim ~/bin/kafka | |
# ~/bin/kafka | |
#!/bin/bash | |
zkServer start | |
kafka-server-start.sh /usr/local/etc/kafka/server.properties |
NewerOlder