Skip to content

Instantly share code, notes, and snippets.

View foucist's full-sized avatar

James Robey foucist

View GitHub Profile
class Account < ApplicationRecord
# Include default devise modules. Others available are:
# :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable, :confirmable,
:recoverable, :rememberable, :trackable, :validatable
has_one :profile, dependent: :destroy
accepts_nested_attributes_for :profile
validates_presence_of :email
class Account < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
has_one :profile, dependent: :destroy
accepts_nested_attributes_for :profile
validates_presence_of :email
@foucist
foucist / expng.ex
Created October 29, 2019 11:13 — forked from zabirauf/expng.ex
PNG format Parser in Elixir
defmodule Expng do
defstruct [:width, :height, :bit_depth, :color_type, :compression, :filter, :interlace, :chunks]
def png_parse(<<
0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A,
_length :: size(32),
"IHDR",
width :: size(32),
height :: size(32),
@foucist
foucist / keybase.md
Created September 12, 2019 02:31
kb

Keybase proof

I hereby claim:

  • I am foucist on github.
  • I am foucist (https://keybase.io/foucist) on keybase.
  • I have a public key ASD3fsCRowaBsZobY6pjB1oIGR9DoRXt9iQFMwx2PUtb1Qo

To claim this, I am signing this object:

@foucist
foucist / urlsafari
Created October 16, 2018 13:46 — forked from kshiteesh/urlsafari
This AppleScript saves all the tabs open in all Safari windows to a Markdown file.
(*
Export All Safari Tabs in All Open Windows to a Markdown File
July 13, 2015
// SCRIPT PAGE
http://hegde.me/urlsafari
// ORIGINAL SCRIPT ON WHICH THIS SCRIPT IS BUILT
http://veritrope.com/code/export-all-safari-tabs-to-a-text-file
@foucist
foucist / index.html
Last active September 20, 2018 07:20
preliminary clone of angular.io with tailwind css
<!doctype html>
<html lang="en">
<head>
<title>Tailwind Starter Template</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
</head>
<body>
<div class="container bg-blue-dark">
<div class="bg-blue flex items-center py-1">
@foucist
foucist / css-grid.md
Created April 7, 2018 12:33 — forked from osban/css-grid.md
css grid summary

Grid

  1. define grid container element (parent) -> display: grid
  2. set its column and row sizes -> grid-template-columns and grid-template-rows
  3. place grid items (children) into the grid -> grid-column and grid-row
  • children are only the direct descendants of the parent element
  • Note: column, float, clear, and vertical-align have no effect on a grid container.

Terminology

@foucist
foucist / RiotControl.js
Created November 18, 2016 13:56 — forked from assertnotnull/RiotControl.js
Autonomous riot.js paging
var RiotControl = {
_stores: [],
addStore: function(store) {
this._stores.push(store);
}
};
['on','one','off','trigger'].forEach(function(api){
RiotControl[api] = function() {
var args = [].slice.call(arguments);
class Price
def pricer(quantity, item)
end
case
when setpoint
SetPrice
when bulkpoint
BulkPrice
end
class Message::Collection::Count
MENU_TYPES = %w{message gift flirt access_granted request_access}
def initialize(profile)
@profile = profile
end
def self.unread_counts_for(profile)
new(profile).unread_message_counts
end