Skip to content

Instantly share code, notes, and snippets.

@digitalkaoz
digitalkaoz / index.js
Created December 20, 2017 21:32
gatsby in aws lambda
const AWS = require("aws-sdk");
const {link} = require("linkfs");
const mock = require('mock-require');
const fs = require('fs');
const tmpDir = require('os').tmpdir();
exports.handler = (event, context) => {
rewriteFs();
invokeGatsby(context);
}
/**
Provides the ability to verify key paths at compile time.
If "keyPath" does not exist, a compile-time error will be generated.
Example:
// Verifies "isFinished" exists on "operation".
NSString *key = SQKeyPath(operation, isFinished);
// Verifies "isFinished" exists on self.
@Orangenhain
Orangenhain / import_minimizer.rb
Created November 28, 2013 12:45
Script that takes a ObjC .m file and tries to find unused (or duplicate) import statements by commenting out each #import line in turn and seeing if the project still compiles. You will have to change BUILD_DIR & BUILD_CMD.
#!/usr/bin/env ruby -w
class String
def starts_with?(prefix)
prefix.respond_to?(:to_str) && self[0, prefix.length] == prefix
end
end
HEADER_REGEX = /^#import\s+["<](.*)[">]/
@alloy
alloy / gist:4656055
Last active December 11, 2015 20:29

Counter webapp with ping API.

Even well-intended developers will try to see if they can game/exploit a system, so we MUST assume this will happen.

  • It is impossible to have accurate counting, so we can just as well keep everything as simple as possible.

  • No ranking overviews! This is useless data anyways and will make people less inclined to game the system. Only show download counter for individual libs and a graph over the versions/days. This is useful to author and others, as you can see increase/decrease overall, without having to be super-accurate.

  • Add ‘rating’ with required comment on why a rating is X. This rating can be shown in search result list to sort by. But again, NEVER in an overall ranking list. Would have loved to go for 1-2-3 rating, but that would mean most libs get a 2. Need to work on the labels, so that reviews get the most meaningful rating that others can relate to. E.g. a user rates it with a ‘1’ and comments: “crashes while uploading files”. Other user looks at revi

@alloy
alloy / .travis.yml
Last active December 11, 2015 18:38
language: objective-c
env:
# This is what 10.8.x comes with and we want to support that.
- RVM_RUBY_VERSION=system NOEXEC_DISABLE=1 RUBY_VERSION_SPECIFIC='sudo gem update --system && sudo gem install bundler --no-ri --no-rdoc'
- RVM_RUBY_VERSION=1.9.3 NOEXEC_DISABLE=1 RUBY_VERSION_SPECIFIC='sudo ln -s /usr/bin/llvm-gcc-4.2 /usr/bin/gcc-4.2 && curl http://curl.haxx.se/ca/cacert.pem -o /usr/local/share/cacert.pem' SSL_CERT_FILE=/usr/local/share/cacert.pem
before_install: source ~/.rvm/scripts/rvm && rvm use $RVM_RUBY_VERSION
install: eval $RUBY_VERSION_SPECIFIC && rake bootstrap
script: bundle exec rake spec:ci
@kevinSuttle
kevinSuttle / meta-tags.md
Last active March 31, 2024 14:26 — forked from lancejpollard/meta-tags.md
List of Usable HTML Meta and Link Tags
Rails.configuration.middleware.use Rack::OpenID
Rails.configuration.middleware.use RailsWarden::Manager do |manager|
manager.default_strategies :remember_me_token, :password_form, :api_token, :openid
manager.failure_app = ExceptionsController
end
# Setup Session Serialization
class Warden::SessionSerializer
def serialize(record)