Skip to content

Instantly share code, notes, and snippets.

View phirefly's full-sized avatar

Raphael (Raphy) Villas phirefly

View GitHub Profile
@phirefly
phirefly / colorsorter.js
Last active March 4, 2021 12:11
Lego Robotics: Color Sorter Snippets
// Startup
brick.showMood(moods.awake);
brick.showString("Hello world", 1);
music.playSoundEffect(sounds.communicationHello);
music.playSoundEffectUntilDone;
motors.largeD.run(-50, 3, MoveUnit.Seconds);
sensors.touch1.onEvent(ButtonEvent.Pressed, function () {
brick.showImage(images.eyesWinking);
})
@phirefly
phirefly / favorite_reflex.rb
Created May 27, 2020 00:12
FavoriteReflex code
class FavoriteReflex < StimulusReflex::Reflex
def add_favorite
Favorite.create!(user_id: element.dataset[:userid],
thing_id: element.dataset[:thingid]
)
end
def remove_favorite
favorite = Favorite.find_by(user_id: element.dataset[:userid],
thing_id: element.dataset[:thingid])
@phirefly
phirefly / reflex-markup.html.erb
Created May 27, 2020 00:11
Markup for favoriting links
<div class="flex flex-wrap -mb-4">
<% @things.each do |thing| %>
<div class="w-1/3 max-w-sm rounded overflow-hidden shadow-lg">
<div class="px-6 py-4">
<div class="font-bold text-xl mb-2"><%= thing.title %> </div>
<p class="text-gray-700 text-base">
ID: <%= thing.id %>
</p>
<p class="text-gray-700 text-base">
<%= thing.description || "Description TBD" %>
<% @requests.each_with_index do |request, index| %>
<li class="border-t border-gray-200">
<a href="#" class="block hover:bg-gray-50 focus:outline-none focus:bg-gray-50 transition duration-150 ease-in-out">
<div class="flex items-center px-4 py-4 sm:px-6">
<div class="min-w-0 flex-1 flex items-center">
<div class="flex-shrink-0">
<img class="h-12 w-12 rounded-full" src="https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80" alt="" />
</div>
<div class="min-w-0 flex-1 px-4 md:grid md:grid-cols-2 md:gap-4">
<div>
# Git
alias gs="git status"
alias gc="git status"
alias gl='git pull origin master'
alias gplom='git pull origin master'
alias gplum='git pull upstream master'
alias gpreb='git pull --rebase'
alias gpsh='git push'
alias gpshom='git push origin master'
alias glog='git lg'
@phirefly
phirefly / ncr-approving-officials.rb
Created February 19, 2016 17:51
ncr-approving-officials
proposals = Proposal.where(client_data_type:'Ncr::WorkOrder')
emails = []
proposals.each {|p| emails << p.approval_steps.first.try(:user).try(:email_address)}
emails.uniq
@phirefly
phirefly / seed-setup-alt.rb
Created October 22, 2015 22:40
c2 seed setup alternative
def self.ba61_tier1_budget_approver
self.with_email_role_slug!(
ENV['NCR_BA61_TIER1_BUDGET_MAILBOX'] || 'ba61.communicart.budget.tier1.approver@gmail.com',
'BA61_tier1_budget_approver',
'ncr'
)
end
def self.ba61_tier2_budget_approver
self.with_email_role_slug!(
@phirefly
phirefly / #101217754-qa
Created September 14, 2015 16:22
101217754-qa
irb(main):054:0> p.public_id
=> "FY15-399"
irb(main):055:0> p.client_data.created_at = 17.days.from_now
=> Thu, 01 Oct 2015 16:18:55 UTC +00:00
irb(main):056:0> p.public_identifier
=> "FY16-399"
@phirefly
phirefly / sublime-user-prefs-20150805.json
Last active September 6, 2015 04:54
sublime-user-prefs-20150805
{
"color_scheme": "Packages/Color Scheme - Default/Solarized2Bd(Light).tmTheme",
"font_face": "Fantasque Sans Mono",
"font_size": 16.0,
"highlight_line": true,
"hot_exit": false,
"ignored_packages":
[
],
"line_padding_top": 3,
@phirefly
phirefly / sublime-font-settings-fira-mono
Created July 12, 2015 03:52
Sublime: Font settings with Fira Mono
{
"color_scheme": "Packages/Color Scheme - Default/Cobalt.tmTheme",
"font_face": "Fira Mono",
"font_size": 18.0,
"highlight_line": true,
"ignored_packages":
[
],
"line_padding_top": 0,
"tab_size": 2,