Skip to content

Instantly share code, notes, and snippets.

View carlqt's full-sized avatar
:octocat:
Hit me up

Carl Tablante carlqt

:octocat:
Hit me up
View GitHub Profile
@carlqt
carlqt / self_collect_station.rb
Last active August 5, 2021 12:37
Pseudocode for update_or_create
class SelfCollectStation
def self.update_or_create(params)
station = detect_or_initialize_by(extension_id: attributes[:extension_id])
if station.persisted?
station.update(attributes)
else
station.save
end
end
@carlqt
carlqt / sidekiq.rb
Created October 16, 2017 03:36
Remove all jobs from sidekiq
Sidekiq.redis { |conn| conn.flushdb }
@carlqt
carlqt / AuthRoute.js
Last active June 8, 2017 01:28
AuthComponent wrapper for handling restricted routes in react.
//AuthRoute.js snippet
import React from 'react';
import { Route, Redirect } from 'react-router-dom';
class AuthRoute extends React.Component {
constructor(props) {
super(props);
this.authenticated = this.authenticated.bind(this);
}
require 'rails_helper'
RSpec.describe Piece, type: :model do
let!(:user) { FactoryGirl.create(:user) }
let!(:game) { FactoryGirl.create(:game, user_id: user.id)}
let!(:piece) { FactoryGirl.create(:piece, x_pos: 3, y_pos: 3, user_id: user.id, game_id: game.id) }
describe "#right_or_left" do
subject(:right_or_left) { piece.right_or_left(destination_x) }
package main
import (
"fmt"
"io/ioutil"
"net/http"
"os"
)
func main() {
@carlqt
carlqt / snippet.jsx
Last active February 14, 2017 13:48
snippet issue for MUICSS Tab
// this is the simple tab snippet to render.
render() {
return (
<Tabs justified={true}>
<Tab value="pane-1" label="Tab 1">Pane-1</Tab>
{this.newInstanceTab(false)}
</Tabs>
);
@carlqt
carlqt / 0_reuse_code.js
Created January 23, 2017 14:55
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@carlqt
carlqt / build.go
Created September 24, 2016 10:50
go build -x results
WORK=/var/folders/h9/m85f0f9x047dbq00dhgq411w0000gn/T/go-build961820340
mkdir -p $WORK/github.com/carlqt/geodude/models/_obj/
mkdir -p $WORK/github.com/carlqt/geodude/
cd /Users/carlwilliamtablante/Projects/Go/src/github.com/carlqt/geodude/models
/usr/local/Cellar/go/1.6.3/libexec/pkg/tool/darwin_amd64/compile -o $WORK/github.com/carlqt/geodude/models.a -trimpath $WORK -p github.com/carlqt/geodude/models -complete -buildid 8e77d3dc73c8d9cd4539660467763416273c1e37 -importmap github.com/lib/pq=github.com/carlqt/geodude/vendor/github.com/lib/pq -importmap github.com/shopspring/decimal=github.com/carlqt/geodude/vendor/github.com/shopspring/decimal -importmap golang.org/x/crypto/bcrypt=github.com/carlqt/geodude/vendor/golang.org/x/crypto/bcrypt -importmap gopkg.in/yaml.v2=github.com/carlqt/geodude/vendor/gopkg.in/yaml.v2 -D _/Users/carlwilliamtablante/Projects/Go/src/github.com/carlqt/geodude/models -I $WORK -I /Users/carlwilliamtablante/Projects/Go/pkg/darwin_amd64 -pack ./db.go ./property.go ./user.go
mkdir -p $
@carlqt
carlqt / property.go
Created September 24, 2016 08:59
property
package properties
import(
"github.com/shopspring/decimal"
"github.com/gin-gonic/gin"
"github.com/fatih/color"
"github.com/carlqt/geodude/geocode"
"net/http"
"strconv"
"github.com/carlqt/geodude/models"
@carlqt
carlqt / main.go
Created September 24, 2016 08:57
main file
package main
import (
"fmt"
"github.com/carlqt/geodude/controllers/properties"
"github.com/carlqt/geodude/controllers/user"
"github.com/carlqt/geodude/geocode"
"github.com/carlqt/geodude/models"
"github.com/dgrijalva/jwt-go"