Skip to content

Instantly share code, notes, and snippets.

Evan Alter hadees

Block or report user

Report or block hadees

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 letter_closings.yml
en:
letter_closings:
- Adios
- All best wishes
- All best, always
- Always in my thoughts
- As always, with affection
- Be good
- Be well
- Best Regards
View js
// Run on https://www.youtube.com/user/foobar/playlists?view=1&shelf_id=0&sort=dd
function getParents(el, parentSelector /* optional */) {
// If no parentSelector defined will bubble up all the way to *document*
if (parentSelector === undefined) {
parentSelector = document;
}
var parents = [];
View rails-json-schema-validation.md

Validate JSON schema in Rails

Topics

  1. What/Why JSON schema
  2. Apply to rails model validation
  3. Test your API endpoint with schema matcher
  4. Homework for a curious reader
  5. References
View FoodSafety.sol
pragma solidity ^0.4.20;
interface FoodSafety {
function owner
function transfer
function split
View keybase.md

Keybase proof

I hereby claim:

  • I am hadees on github.
  • I am hadees (https://keybase.io/hadees) on keybase.
  • I have a public key whose fingerprint is A0C1 850A 15D1 1F77 DA03 94F3 367E 21AD A895 8278

To claim this, I am signing this object:

View boolean_value.rb
class BooleanValue
# https://github.com/rails/rails/blob/master/activerecord/lib/active_record/connection_adapters/column.rb#L8
FALSE_VALUES = [false, 0, "0", "f", "F", "false", "FALSE", "off", "OFF"]
def self.convert(value)
Rails.present? ? with_rails(value) : without_rails(value)
end
private
@hadees
hadees / model.rb
Created Sep 20, 2016
Model Template
View model.rb
<% module_namespacing do -%>
class <%= class_name %> < <%= parent_class_name.classify %>
### Default Scope
### Includes and Extensions
### Constants
### Virtual attributes
View youtube-dl
$ youtube-dl --autonumber-size 3 --restrict-filenames -o "S01E%(autonumber)s-%(title)s.%(ext)s" --playlist-reverse https://www.youtube.com/playlist?list=PLE7j5FieXSTc-2gbs7NkrDPhkS_rQS9XT
View iframe.js
$(document).ready(function() {
if(window.self !== window.top) {
var padding = 200;
var currentHeight = window.ApplicationHelpers.pageHeight() + padding;
var resizeIframeTracker = setInterval(function() {
$(document).ready(function() {
var height = window.ApplicationHelpers.pageHeight() + padding;
if(currentHeight !== height) {
message = JSON.stringify({"frameHeight": height});
window.parent.postMessage(message, "*");
View iframe.js
$(document).ready(function() {
if(window.self !== window.top) {
var currentHeight = document.body.clientHeight;
var resizeIframeTracker = setInterval(function() {
var height = document.body.clientHeight;
if(currentHeight !== height) {
message = JSON.stringify({"frameHeight": height})
window.parent.postMessage(message, "*");
currentHeight = height;
}
You can’t perform that action at this time.