Skip to content

Instantly share code, notes, and snippets.

View tbjers's full-sized avatar
🙃

Torgny Bjers tbjers

🙃
View GitHub Profile
@tbjers
tbjers / attribute_requirements.rb
Created February 28, 2016 04:01 — forked from bvandgrift/attribute_requirements.rb
a terrible way to determine whether attrs on an ActiveRecord model are optional or required when using grape.
module AttributeRequirements
extend ActiveSupport::Concern
SQL_TYPE_MATCHERS = {
/^character varying/ => String,
/^text/ => String,
/^enum/ => String,
/^timestamp/ => DateTime,
/^integer/ => Integer,

Keybase proof

I hereby claim:

  • I am tbjers on github.
  • I am tbjers (https://keybase.io/tbjers) on keybase.
  • I have a public key whose fingerprint is 6AA8 0D1F 9E75 594A 9C1B CFE2 15B5 3F48 CECB 02C4

To claim this, I am signing this object:

@tbjers
tbjers / _dependency-chain.md
Created October 27, 2015 16:34
Meteor dependency chain to figure out where jQuery is included as a dependency
meteor-base
`-webapp
  `-boilerplate-generator
    `-ui
      `-blaze
        `-jquery

I guess this comes back to the "DOM backend" issue, huh?

@tbjers
tbjers / cheesy-veg-tatertot-casserole.txt
Last active August 29, 2015 14:17
Cheesy Vegetarian Tater Tot Breakfast Bake
Original recipe from Chew Out Loud has been modified to use vegetarian ingredients.
http://www.chewoutloud.com/2015/01/27/cheesy-tater-tot-breakfast-bake/
Servings: 5-6
INGREDIENTS
5 slices of Morningstar Bacon
1 bag of Morningstar Original Crumbles
3 cups of Four Cheese Mexican Blend grated cheese
@tbjers
tbjers / app.html
Last active December 20, 2015 16:29
Node.js: Scaffolding Modern Web Applications with Flatiron
<!DOCTYPE html>
<html>
<head>
<title>Flatiron Example</title>
</head>
<body>
<div id="body"></div>
</body>
</html>
@tbjers
tbjers / .travis.yml
Created July 30, 2013 03:00
Script for use with Travis CI to build and deploy a Jekyll site to Github Pages
language: ruby
rvm:
- 1.9.3
script: rake generate
after_success: bash post_build.sh
@tbjers
tbjers / Preferences.sublime-settings.json
Created July 7, 2013 17:26
Sublime Text user configuration
{
"font_size": 13,
"tab_size": 2,
"translate_tabs_to_spaces": true,
"use_tab_stops": false,
"word_wrap": false,
"highlight_line": true,
"caret_style": "phase",
"match_brackets_angle": true,
"default_line_ending": "unix",
@tbjers
tbjers / .gitconfig
Created March 21, 2013 17:51
git aliases I cannot live without...
[alias]
st = status
ci = commit
br = branch
co = checkout
df = diff
sync = !sh -c 'git pull && git diff --quiet HEAD || (git commit $1 && git push)' -
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
edit-unmerged = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; sublime_text `f`"
add-unmerged = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; git add `f`"
@tbjers
tbjers / check-apache-instances.sh
Last active April 6, 2023 18:25
Script to determine Apache ServerLimit and MaxClients.
#!/bin/sh
available=$(free --mega -tw | grep "Total:" | awk '{print $4}')
ps -ylC httpd --sort:rss | awk -v avail="$available" '{ s += $8; } END { print "Average Size:", s/(NR-1)/1024, "MB,", NR-1, "Processes, Total usage:", (s/(NR-1)/1024)*(NR-1), "MB, Max Servers:", avail/(s/(NR-1)/1024) }'