Instantly share code, notes, and snippets.

View svgdefs.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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;
};
View dabblet.css
/**
* The first commented line is your dabblet’s title
*/
/*
.row{
}
.row::before, .row::after{
content: ' ';
display: table;
}
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)
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')
}
}
View introrx.md
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.
View gulpfile.js
var gulp = require('gulp'),
sass = require('gulp-sass'),
concat = require('gulp-concat'),
gutil = require('gulp-util'),
uglify = require('gulp-uglify'),
postcss = require('gulp-postcss'),
nano = require('gulp-cssnano'),
concatCss = require('gulp-concat-css'),
autoprefixer = require('autoprefixer'),
sourcemaps = require('gulp-sourcemaps'),