Skip to content

Instantly share code, notes, and snippets.

View mattjstar's full-sized avatar

Matthew Star mattjstar

  • Fathom
  • Philadelphia, PA
View GitHub Profile
@mattjstar
mattjstar / react_twitter.txt
Last active April 20, 2017 06:38
React Twitter
https://twitter.com/_chenglou
https://twitter.com/React_Rocks
https://twitter.com/ryanflorence
https://twitter.com/leeb
https://twitter.com/Vjeux
https://twitter.com/reactjs
https://twitter.com/acdlite
https://twitter.com/ReactEurope
https://twitter.com/dan_abramov
@mattjstar
mattjstar / assign.js
Created October 27, 2016 19:25
Object Assignment in JS
const arr1 = [1,2,3];
console.log("arr1 BEFORE PUSH: ", arr1);
arr1.push(4);
console.log("arr2 AFTER PUSH", arr1);
const a1 = [1,2,3];
console.log("a1 BEFORE CONCAT: ", a1);
const a2 = a1.concat([4,5,6]); // [ ...a1, 4,5,6 ]
console.log("a1 AFTER CONCAT: ", a1);
console.log("a2 AFTER CONCAT: ", a2);

SpaceStation Mobile:

Our Community Managers used to run our 100+ buildings with google spreadsheets. Giving them one mobile​ place to manage our members and the day to day sales process has been huge. We were able to have an entire team onboarded to the SpaceStation Mobile codebase in a matter of days, which really speaks to the power of React Native.

WeWee:

@mattjstar
mattjstar / presentationalComponents.js
Last active June 5, 2016 23:20
Presentational Components
import React from 'react';
import style from '../typography/typography.scss';
class Paragraph extends React.Component {
render() {
return (
<p className={style.para}>{this.props.children}</p>
);
}
}
info = {
email: email,
name: name,
date: Date.today.strftime("%Y-%d-%m"), #"2014-01-29"
customerId: Random.rand(11),
lat: current_location[:latitude].to_s,
lon: current_location[:longitude].to_s,
location_uuid: location_uuid
}.to_json
@mattjstar
mattjstar / spoof.rb
Created June 8, 2015 22:07
Spoof Rails IP
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
require 'rails/commands/server'
module Rails
class Server
def default_options
if Rails.env.development?
@mattjstar
mattjstar / Devise Override
Last active August 29, 2015 14:06
Devise Override
# routes.rb
devise_for :users, :path => '', :path_names => {:sign_in => 'login', :sign_out => 'logout'}, :controllers => { :registrations => 'registrations', :sessions => 'sessions' }
# registrations_controller.rb
class RegistrationsController < Devise::RegistrationsController
def create
if the token is present?
resource.user_group_id = #usergroupid
@mattjstar
mattjstar / gist:a9e3ccfec3b7f2d14dae
Last active August 29, 2015 14:05
Daniel Data Model
class Item < ActiveRecord::Base
has_many :user_group_items
has_many :user_groups, through: :user_group_items
end
class UserGroup < ActiveRecord::Base
has_many :user_group_items
has_many :items, through: :user_group_items
end
@mattjstar
mattjstar / _articles_collection.html.erb
Last active August 29, 2015 14:02
AJAX for Articles! (Thinkful Office Hour: 6/23/14)
<% articles.each_slice(4) do |four_articles| %>
<div class="row">
<% four_articles.each do |article| %>
<%= render 'garments/article', article: article, garment: @garment %>
<% end %>
</div>
<% end %>