Skip to content

Instantly share code, notes, and snippets.

@seamusabshere
seamusabshere / delayed_job_singleton.rb
Created February 18, 2011 15:38
how we hacked DelayedJob 2.0.3 logs in Rails 3
#!/usr/bin/env ruby
PRESUMPTIVE_RAILS_ROOT = "/data/[APP_NAME]/current"
LOG_PATH = "/data/[APP_NAME]/shared/log/delayed_job_singleton.log"
Dir.chdir PRESUMPTIVE_RAILS_ROOT
require 'home_run'
require "rubygems"
require "bundler/setup"
@mhawksey
mhawksey / gist:1276293
Last active October 23, 2023 09:00
Google App Script to insert data to a google spreadsheet via POST or GET - updated version as per https://mashe.hawksey.info/2014/07/google-sheets-as-a-database-insert-with-apps-script-using-postget-methods-with-ajax-example/
/*
Copyright 2011 Martin Hawksey
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@pavelbinar
pavelbinar / gist:6333285
Last active July 27, 2022 07:49
JavaScript: Random Boolean
/* Random Boolean */
var randomNumber = Math.random() >= 0.5;
console.log(randomNumber);
@hwdsl2
hwdsl2 / .MOVED.md
Last active May 19, 2024 06:28
IPsec VPN Server Auto Setup Script for Ubuntu and Debian
@SauloSilva
SauloSilva / each_slice.js
Last active May 8, 2019 16:09
Each slice javascript
// without callback
Array.prototype.eachSlice = function (size){
this.arr = []
for (var i = 0, l = this.length; i < l; i += size){
this.arr.push(this.slice(i, i + size))
}
return this.arr
};
[1, 2, 3, 4, 5, 6].eachSlice(2)
@markusklems
markusklems / lambda-dynamodb-scan
Created January 19, 2015 23:46
Short aws lambda sample program that scans a dynamodb table
// create an IAM Lambda role with access to dynamodb
// Launch Lambda in the same region as your dynamodb region
// (here: us-east-1)
// dynamodb table with hash key = user and range key = datetime
console.log('Loading event');
var AWS = require('aws-sdk');
var dynamodb = new AWS.DynamoDB({apiVersion: '2012-08-10'});
exports.handler = function(event, context) {
@yoavniran
yoavniran / ultimate-ut-cheat-sheet.md
Last active June 1, 2024 09:44
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest
@eliotsykes
eliotsykes / rails_new_help_output.md
Last active March 31, 2024 17:09
"rails new" options explained

Run rails new --help to view all of the options you can pass to rails new:

$ bin/rails new --help
Usage:
  rails new APP_PATH [options]

Options:
  -r, [--ruby=PATH]                                      # Path to the Ruby binary of your choice
                                                         # Default: /Users/eliot/.rbenv/versions/2.2.0/bin/ruby
@haasn
haasn / about:config.md
Last active April 2, 2024 18:46
Firefox bullshit removal via about:config

Firefox bullshit removal

Updated: Just use qutebrowser (and disable javascript). The web is done for.

@klappradla
klappradla / post-deploy.yml
Created November 27, 2015 12:12
Rake tasks as post deploy hooks for AWS Elastic Beanstalk Puma-Rails applications
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/01_do_stuff.sh" :
mode: "000755"
owner: ec2-user
group: ec2-user
content: |
#! /usr/bin/env bash
# Using similar syntax as the appdeploy pre hooks that is managed by AWS
set -xe