Skip to content

Instantly share code, notes, and snippets.

View jtallant's full-sized avatar
:octocat:

Justin Tallant jtallant

:octocat:
View GitHub Profile
@jtallant
jtallant / importing.md
Created February 22, 2021 18:11
Importing ES6 Classes
View importing.md

/js/AppLazyLoad.js

export default class AppLazyLoad {
    init() {
        console.log('do lazy load work');
    }
}

/js/app.js

@jtallant
jtallant / justin.zsh-theme
Last active February 6, 2021 04:42
ZSH Theme
View justin.zsh-theme
# vim:ft=zsh ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
#
@jtallant
jtallant / choose-adventure-helper.rb
Created December 13, 2016 22:37
Choose your own adventure Ruby helper
View choose-adventure-helper.rb
class Choice
attr_reader :text
attr_reader :decision_a
attr_reader :decision_b
def initialize(text, decision_a, decision_b)
@text = text
@decision_a = decision_a
@decision_b = decision_b
end
@jtallant
jtallant / mass-assignment.md
Last active December 12, 2016 19:28
Mass Assignment
View mass-assignment.md

// app/views/users/edit.html.erb

<form action="/users/1" method="POST">
    <input type="hidden" name="_method" value="PUT"
    <input type="text" name="username" value="jtallant">
    <input type="email" name="email" value="justin.tallant@nycda.com">
    <textarea name="bio">Bio goes here</textarea>
</form>
@jtallant
jtallant / setting-up-sinatra-with-active-record.md
Last active August 13, 2023 11:15
Setting up Sinatra with Active Record
View setting-up-sinatra-with-active-record.md

Setting up Sinatra Project

create an empty project and add a Gemfile

cd ~/Desktop
mkdir project-name
cd project-name
touch Gemfile
@jtallant
jtallant / routeaf.php
Created April 13, 2016 16:21
route-anonymous-function
View routeaf.php
<?php
Route::get('projects/messages', function() {
$data = [
'messages' => [
'title' => 'Sidebar is cut off',
'author' => ['name' => 'John Doe', 'email' => 'foo@example.com']
]
];
return view('projects.messages', $data); # views/projects/messages.twig
@jtallant
jtallant / doctrine-fk.php
Created February 25, 2016 22:22
Doctrine Foreign Key Management
View doctrine-fk.php
<?php
class Post
{
public function addComment(Comment $comment)
{
$this->comments->add($comment);
$comment->setPost($this);
}
}
@jtallant
jtallant / acl.php
Last active February 12, 2016 23:05
ACL Interface
View acl.php
<?php
interface AccessControl
{
public function userCan($action);
}
class BitmaskAccessControl implements AccessControl
{
public function userCan($action)
View screenshots.md

Screenshots

Feature: Send a screenshot when an issue is submitted.

Analyzing the feature:

A screenshot of an issue helps the developer/pm recognize the issue. The screenshot could help isolate the problem which will help ensure the problem is correctly recognized and fixed. The screenshot could also help the developer fix the bug faster and reduce communication time.

The requested feature says to just send one image with the issue. The image is a screenshot of whatever page the user was on when they submitted the issue.

Even though the feature only asks for one screenshot. It's very possible that users will eventually want to attach multiple images to an issue. These images could be attached in different locations with different methods. Maybe users will want to attach more images to an issue through the dispatch web UI. Maybe users will eventually want to attach multiple images through the embedded widget.

Now we need to decide if we should code the feature with the ability to have multiple image

@jtallant
jtallant / html2canvas.md
Last active November 20, 2015 21:25
html2canvas
View html2canvas.md
html2canvas($('#content'), {
    onrendered: function(canvas) {
        var dataURL = canvas.toDataURL();
        var posting = $.post(BASE + '/profiles/' + site_id + '/send-report-emails', {
            emails: emails,
            message: message,
            data_uri: dataURL
        });