Skip to content

Instantly share code, notes, and snippets.

'use strict';
var React = require('react-native');
var {
Bundler,
StyleSheet,
Text,
TouchableHighlight,
View,
ScrollView,
@mahmoudimus
mahmoudimus / 04run-envfile.patch
Created December 18, 2014 00:20
Patch to run on elastic beanstalk to allow docker to use an --env-file cmdline argument
--- elasticbeanstalk/hooks/appdeploy/pre/04run.sh 2014-12-12 11:07:47.000000000 -0800
+++ elasticbeanstalk/hooks/appdeploy/pre/04run.sh-new 2014-12-17 15:31:45.000000000 -0800
@@ -65,6 +65,14 @@
EB_CONFIG_DOCKER_ENV_ARGS+=(--env "$ENV_VAR")
done < <($EB_SUPPORT_FILES/generate_env)
+# build --env-file arguments for docker
+
+EB_CONFIG_DOCKER_ENVFILE=()
+
@sebmarkbage
sebmarkbage / react-terminology.md
Last active January 9, 2023 22:47
React (Virtual) DOM Terminology
import numpy as np
def loadSparseMatrix(filename):
"""
Loads the sparse matrix in text file `filename` assuming the
Matlab format.
Each row of the file should specify the non-zero value
at a particular location, using 1 based indexes, formatted as follows:
@bomberstudios
bomberstudios / sketch-plugins.md
Last active February 26, 2024 07:02
A list of Sketch plugins hosted at GitHub, in no particular order.
@pcreux
pcreux / Gemfile
Last active December 11, 2023 20:24
Fast Rails + Heroku Configuration
group :production do
gem 'unicorn'
# Enable gzip compression on heroku, but don't compress images.
gem 'heroku-deflater'
# Heroku injects it if it's not in there already
gem 'rails_12factor'
end
@flesch
flesch / basic-auth.js
Last active July 27, 2022 12:39
HTTP Basic Authentication with Express, without express.basicAuth.
var express = require("express");
var app = express();
app.get("/restricted", function(req, res, next){
// Grab the "Authorization" header.
var auth = req.get("authorization");
// On the first request, the "Authorization" header won't exist, so we'll set a Response
// header that prompts the browser to ask for a username and password.
@ordoghl
ordoghl / polymorphic_ass_grape_entity
Created September 19, 2013 14:02
Polymorphic association in a grape entity
require_relative 'customer.rb'
require_relative 'contact.rb'
require_relative 'agent.rb'
module Api
module V1
module Entities
class Ticket < Grape::Entity
expose :id
@maxim
maxim / rails_load_path_tips.md
Last active January 9, 2025 00:59
How to use rails load paths, app, and lib directories.

In Rails 3

NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths

If you add a dir directly under app/

Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.

If you add a dir under app/something/

@linjunpop
linjunpop / deploy-rails-4-app-with-dokku-on-digital-ocean.md
Last active September 11, 2024 10:21
Deploy Rails 4 app with Dokku on DigitalOcean

Deploy Rails 4 app with Dokku on DigitalOcean

Install dokku

First create a Ubuntu 13.04 x64 droplet on DigitalOcean Control Panel

Then ssh with root account, run this in termianl:

$ wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh | sudo bash