Skip to content

Instantly share code, notes, and snippets.

@donnut
donnut / currying.md
Last active October 28, 2023 17:58
TypeScript and currying

TypeScript and currying

In functional programming you often want to apply a function partly. A simple example is a function add. It would be nice if we could use add like:

var res2 = add(1, 3); // => 4

var add10To = add(10);
var res = add10To(5); // => 15
anonymous
anonymous / menus
Created March 6, 2014 16:19
STW API proposals
[
{
"date": "2014-03-06",
"nameGerman": "Rinderschmorbraten mit Orange und Rosmarin",
"nameEnglish": "Translated Rinderschmorbraten mit Orange und Rosmarin",
"category": "LUNCH",
"priceStudents": 1.6,
"priceWorkers": 2.7,
"priceGuests": 3.2,
"allergens": [
@gesquive
gesquive / self-update-script.py
Last active May 28, 2024 23:23
Stick this in a python script to self update the script from an online source
def update(dl_url, force_update=False):
"""
Attempts to download the update url in order to find if an update is needed.
If an update is needed, the current script is backed up and the update is
saved in its place.
"""
import urllib
import re
from subprocess import call
def compare_versions(vA, vB):
@dgehrett
dgehrett / LICENSE
Last active August 18, 2016 14:10
Source code for a Code Climate Dashing widget for use with the Shopify Dashing framework (https://github.com/Shopify/dashing). It shows a single repository's GPA. See more widgets we've made at https://github.com/Homefinder/dashing-widgets
The MIT License (MIT)
Copyright (c) 2013 HomeFinder.com
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
@hofmannsven
hofmannsven / README.md
Last active July 16, 2024 01:30
Git CLI Cheatsheet
@deanet
deanet / google.sh
Created August 22, 2012 16:09
Uploading File into Google Drive (because grive too many dependencies qt, xorg ? )
#!/bin/bash
## uploading to google
## rev: 22 Aug 2012 16:07
det=`date +%F`
browser="Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:13.0) Gecko/20100101 Firefox/13.0.1"
username="user@domain-apps.com"
password="password"
accountype="HOSTED" #gooApps = HOSTED , gmail=GOOGLE
@zealot128
zealot128 / README.md
Created August 13, 2012 21:15
Debian startup file for Rails thin instances

Rails startup with bundler, rvm and specific user

e.g. for user stefan, starting two different applications, located under /apps/APPLICATION/prod/current.

This script is very useful, because it is run at startup of server, so no 503 anymore.

Put this script under /etc/init.d/ and make it executable chmod +x /etc/init.d/rails_apps

@tokland
tokland / ar_arel_wrapper.rb
Last active March 5, 2024 06:22
Simple wrapper over arel
require 'active_record'
require 'arel'
# Ruby-like syntax in AR conditions using the underlying Arel layer (Rails >= 3.0).
#
# What you would usually write like this:
#
# User.where(["users.created_at > ? AND users.name LIKE ?", Date.yesterday, "Mary"])
#
# can now be written like this (note those parentheses required by the operators precedences):
@grosser
grosser / rails_admin_without_devise.md
Last active July 27, 2016 06:25 — forked from huned/rails_admin_without_devise.md
Using RailsAdmin without devise

Using rails_admin without devise

Add RailsAdmin to your Gemfile

do NOT add devise

gem "rails_admin", :git => "git://github.com/sferik/rails_admin.git"

Bundle

@maccman
maccman / juggernaut_heroku.md
Created June 2, 2011 01:26
Juggernaut on Heroku

Clone repo:

git clone git://github.com/maccman/juggernaut.git
cd juggernaut

Create Heroku app:

heroku create myapp --stack cedar
heroku addons:add redistogo:nano

git push heroku master