Skip to content

Instantly share code, notes, and snippets.

Avatar

Gregg Horton greggawatt

View GitHub Profile
View push_logs.sh
echo "Pushing logs to cloudlog"
cd ~/Radio/adifpush/adifpush
dotnet run ~/.local/share/WSJT-X/wsjtx_log.adi
dotnet run ~/.local/share/JS8Call/js8call_log.adi
echo "Logs pushed!"
View gist:5d3b17a842d3a90c20074db9ddad79de
{
"window.zoomLevel": 1,
"files.autoSave": "afterDelay",
"workbench.editor.enablePreview": false,
"workbench.editor.enablePreviewFromQuickOpen": false,
"editor.tabSize": 2,
"files.insertFinalNewline": true
}
View gist:96d819c19bb58dff3581ea9fd653ccf1
@output = []
@container.start
# sleep 10 # If I put the sleep here, it gives me the output correctly but I don't want to use a sleep.
@container.streaming_logs(stdout: true) { |stream, chunk| @output << chunk }
puts @output
>> ["Cloning https://github.com/RailsApps/learn-rails.git\n"]
Expected Output:
~ docker logs 5be66680bea4
@greggawatt
greggawatt / gist:3909c8339529548b49d9
Created Mar 28, 2016
Example of agnostic relationship
View gist:3909c8339529548b49d9
class Opportunity < ActiveRecord::Base
has_many :notes
end
class Note < ActiveRecord::Base
end
On the opportunity model I want a way when the Note updates (the updated_at column changes) that a column on the opportunity (note_last_updated or similar) updates. Notes are used all over my app so i wanted to avoid having a specific after_update callback on the note model.
View keybase.md

Keybase proof

I hereby claim:

  • I am greggawatt on github.
  • I am greggawatt (https://keybase.io/greggawatt) on keybase.
  • I have a public key whose fingerprint is 2F04 A420 3C8C 9750 3B89 6AD4 A164 1C99 A275 4372

To claim this, I am signing this object:

View facebook-mass-delete-group-members.js
var deleteAllGroupMembers = (function () {
var deleteAllGroupMembers = {};
// the facebook ids of the users that will not be removed.
// IMPORTANT: add your own facebook id here so that the script will not remove yourself!
var excludedFbIds = ['77000939']; // make sure each id is a string!
var usersToDeleteQueue = [];
var scriptEnabled = false;
var processing = false;
deleteAllGroupMembers.start = function() {
@greggawatt
greggawatt / gist:fbc75d110bc9948ab802
Created Jan 31, 2015
Ajax call to set a model attribute in coffeescript from ember.js
View gist:fbc75d110bc9948ab802
$.ajax
url: "http://10.0.0.75:8080/packages/" +model.get('id')+"/apk/analytics/selectors"
headers:
Authorization: 'Basic ' + Cookies.utils.readCookie('spch')
success: (response) ->
model.set("selectors", $.map response.selectors, (val) -> val['selector_type'])
error: () ->
console.log "error"
@greggawatt
greggawatt / index.js
Created Oct 3, 2014
Ajax Pagination using the Pagination from Will Paginate
View index.js
$(document).ready(function() {
$('.datepicker').datepicker();
$(".tablesorter").tablesorter();
var submit = document.getElementById("submit-button");
submit.onclick = getCalendarAppointments;
$(".pagination").on("click", 'a', function(event){
event.preventDefault();
@greggawatt
greggawatt / gist:bd4c558bca1ecf9a7bbf
Last active Aug 29, 2015
Javascript Button Handling
View gist:bd4c558bca1ecf9a7bbf
:javascript
$('.disconnect').click(function(event){
event.preventDefault();
var url = event.currentTarget.href
var isGood = confirm("Are You Sure?")
if(isGood){
$.ajax({
type:"POST",
url: url,
success: function(){
View gist:3250eeba31c97cce84e0
<div id="steps">
<h1> Steps </h1>
<h3>Step 1:</h3><label>Title: <input type='text' name='steps[1][title]'></label><label>Summary:<textarea name='steps[1][summary]'></textarea></label>
<label>Step Image: <input type="file" name="recipe[recipe_image]" accept="image/*" /></label> #thisone doesn't work
</div>
<label>Step Image: <input type="file" name="recipe[recipe_image]" accept="image/*" /></label> # this one works