Skip to content

Instantly share code, notes, and snippets.

View josephrexme's full-sized avatar
:octocat:
Training wolves and dragons

Joseph Rex josephrexme

:octocat:
Training wolves and dragons
View GitHub Profile
@josephrexme
josephrexme / countries.json
Created November 27, 2015 15:18
A proper JSON format of countries list
{
"AF": "Afghanistan",
"AX": "Åland Islands",
"AL": "Albania",
"DZ": "Algeria",
"AS": "American Samoa",
"AD": "AndorrA",
"AO": "Angola",
"AI": "Anguilla",
"AQ": "Antarctica",
@josephrexme
josephrexme / timezones.json
Created November 27, 2015 16:50
Timezones in JSON format
[
{
"value": "Dateline Standard Time",
"abbr": "DST",
"offset": -12,
"isdst": false,
"text": "(UTC-12:00) International Date Line West"
},
{
"value": "UTC-11",
@josephrexme
josephrexme / active_data.js.coffee
Created January 29, 2016 09:17 — forked from stephanschubert/active_data.js.coffee
Simple two-way data binding
do ($ = jQuery, exports = window) ->
class ActiveDataBinder
constructor: (uid) ->
# Use a jQuery object as simple PubSub
pubSub = $ {}
# We expect a 'data' attribute specifying the binding
<div class="col-md-8 col-md-offset-1">
<div class="panel panel-default">
<%= form_for(@weekly_performance_review) do |f| %>
<% if @weekly_performance_review.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@weekly_performance_review.errors.count, "error") %> prohibited this weekly_performance_review from being saved:</h2>
<ul>
<% @weekly_performance_review.errors.full_messages.each do |message| %>
<li><%= message %></li>
@josephrexme
josephrexme / gulpfile.js
Created March 3, 2016 18:54
Example gulpfile
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'),
@josephrexme
josephrexme / The Technical Interview Cheat Sheet.md
Created March 17, 2016 15:22 — 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.

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.
@josephrexme
josephrexme / introrx.md
Created May 18, 2016 14:58 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Category extends Model{
public function subcategories(){
return this->hasMany('App\Subcategory')
}
}
@josephrexme
josephrexme / fizzbuzz.sql
Created August 22, 2016 00:53
Fizzbuzz in postgresql
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);
@josephrexme
josephrexme / rspec_rails_cheetsheet.rb
Created September 3, 2016 12:57 — forked from them0nk/rspec_rails_cheetsheet.rb
Rspec Rails cheatsheet (include capybara matchers)
#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)