Skip to content

Instantly share code, notes, and snippets.

View foucist's full-sized avatar

James Robey foucist

View GitHub Profile
@foucist
foucist / gist:575421
Created September 11, 2010 18:25 — forked from crcx/gist:575177
better word names?
with quotes'
( compare two strings from the beginning and return how many )
( similar characters there are before the strings diverge. )
: ^match ( $$-n )
0 -rot repeat @+ [ swap @+ ] dip =if rot 1+ -rot else 2drop ;then again ;
( test each word in the dictionary for similarity. if similar up )
( to the current point, add to the suggestions queue. )
create list here , 100 allot

Retro Style Guide

Author: Charles Childers
Date: September 12, 2010

Formatting

@foucist
foucist / gist:4127990
Created November 21, 2012 21:40 — forked from wmoxam/gist:4127672
Spiral Fun - slight refactoring
def method(grid,root,rev = false)
grid.send(rev ? :reverse_each : :each) do |row|
row.send(rev ? :<< : :unshift, @num)
@num += 1
end
new_row = []
root.times do
new_row.send(rev ? :unshift : :<<, @num)
@num += 1
#
# Regular Expression for URL validation
#
# Converted Diego Perini's regexp to ruby
#
# Author: James Robey
# Updated: 2013/02/07
#
# Credits to Matt (mparodi)
#
class UserSerializer < ActiveModel::Serializer
attributes :id, :name, :phone, :email, :balance, :children, :balance
def attributes
data = super
data[:children] = User.find(data[:id]).subordinates.any?
data
end
end
@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);
@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 / 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 / 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),