Skip to content

Instantly share code, notes, and snippets.

:octocat:
Working on personal projects

Joseph Rex josephrexme

View GitHub Profile
View Redux_explanation.js
// The reducer function looks at each action that comes in
// and based on the type generates a new state based on the
// previous state and any additional data the action carried
const reducer = (state, action) => {
switch (action.type) {
case "COUNT_INCREMENT":
return {
...state,
count: state.count + 1
};
@josephrexme
josephrexme / svgdefs.svg
Created Feb 2, 2018
Example SVG sprite
View svgdefs.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@josephrexme
josephrexme / _grid.scss
Last active Jul 26, 2018
Flexbox grid extract from ionic http://ionicframework.com/docs/components/#grid . For a CSS version, you can transpile here https://www.sassmeister.com
View _grid.scss
/**
* Grid:
* Using flexbox for the grid, inspired by Philip Walton:
* http://philipwalton.github.io/solved-by-flexbox/demos/grids/
* By default each .col within a .row will evenly take up
* available width, and the height of each .col with take
* up the height of the tallest .col in the same .row.
*
* @example
* <div class="row">
View trumpsort.js
const TrumpSort = (arr) => {
let pushArray = [0];
let wallHeight = pushArray[pushArray.length - 1];
arr.forEach((v, i) => {
if(v > wallHeight) pushArray.push(v);
});
pushArray.shift();
return pushArray;
};
@josephrexme
josephrexme / dabblet.css
Created Feb 16, 2017
The first commented line is your dabblet’s title
View dabblet.css
/**
* The first commented line is your dabblet’s title
*/
/*
.row{
}
.row::before, .row::after{
content: ' ';
display: table;
}
@josephrexme
josephrexme / rspec_rails_cheetsheet.rb
Created Sep 3, 2016 — forked from them0nk/rspec_rails_cheetsheet.rb
Rspec Rails cheatsheet (include capybara matchers)
View rspec_rails_cheetsheet.rb
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
@josephrexme
josephrexme / fizzbuzz.sql
Created Aug 22, 2016
Fizzbuzz in postgresql
View fizzbuzz.sql
select generate_series as num,
case when generate_series % 15 = 0
then 'fizzbuzz'
when generate_series % 3 = 0
then 'fizz'
when generate_series % 5 = 0
then 'buzz'
else '' end
as fizzbuzz
from generate_series(1, 100);
View category.php
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Category extends Model{
public function subcategories(){
return this->hasMany('App\Subcategory')
}
}
@josephrexme
josephrexme / introrx.md
Created May 18, 2016 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
View introrx.md
@josephrexme
josephrexme / The Technical Interview Cheat Sheet.md
Created Mar 17, 2016 — forked from TSiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.
View The Technical Interview Cheat Sheet.md

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
You can’t perform that action at this time.