Skip to content

Instantly share code, notes, and snippets.

View jrm2k6's full-sized avatar

Jeremy Dagorn jrm2k6

View GitHub Profile
@jrm2k6
jrm2k6 / gist:6637633
Created September 20, 2013 13:33
brew doctor error.
->brew doctor
Error: no such file to load -- requirements/minimum_macos_requirement
Please report this bug:
https://github.com/mxcl/homebrew/wiki/troubleshooting
/usr/local/Library/Homebrew/requirements.rb:4:in `require'
/usr/local/Library/Homebrew/requirements.rb:4
/usr/local/Library/Homebrew/dependency_collector.rb:4:in `require'
/usr/local/Library/Homebrew/dependency_collector.rb:4
/usr/local/Library/Homebrew/formula.rb:1:in `require'
@jrm2k6
jrm2k6 / res.json
Created April 4, 2019 23:23
Predictions for input: 2234 Brant Street San Diego
[
{
"description": "2234 Brant Street, San Diego, CA, USA",
"id": "9e4be32037a103ef7668e65330a6200518e59c42",
"matched_substrings": [
{
"length": 4,
"offset": 0
},
{
@jrm2k6
jrm2k6 / gist:2314c09b603e03c53488
Last active January 24, 2018 13:10
Typescript code convention

Formatting

spaces vs. tabs

Use only tabs for indentation. Do not use spaces. Yes, spaces would be better :), it's for historical reasons.

curly braces, control flow

  • Always put opening curly braces on new line.
  • Add a space after control flow keywords.
  • Use braces for single line ifs as well
@jrm2k6
jrm2k6 / deploiement.md
Last active December 31, 2017 13:36
Déploiement d'une application flask sur alwaysdata (english version on http://flask-blog.jeremydagorn.com)

Contexte

J'utilise les services offerts par Alwaysdata depuis plus de deux ans maintenant. J'y ai deployé des applis Rails, Django. Cette fois, j'ai voulu m'essayer à du Python une nouvelle fois, mais par l'intermédiaire de Flask. Ce ne fut pas si facile que cela. Pour votre informationm je suis totalement débutant en tout ce qui concerne déploiement et administration système (malgré le fait d'être un utilisateur Linux quotidien). Je fus découragé rapidement devant le manque de documentation concernant le déploiement d'une appli flask sur alwaysdata. C'est pourquoi j'ai décidé d'écrire cet article qui va vous tenter de vous guider pas à pas.

  • installation de python (2.7.5)
  • installation de setuptools et pip
  • installation de virtualenv
  • installation de flask et des librairies requises par votre application.
  • créaction de votre fichier .wsgi
'use strict';
module.exports = {
up: function(queryInterface, Sequelize) {
return queryInterface.createTable('pictures', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
<?php namespace Testing\Traits;
trait DatabaseTruncate
{
/**
* Define hooks to truncate the database before each test.
*
* @return void
*/
public function runTruncateDatabase()
-- problem 48
tablen f n = do
let r = generateResultsAsStrings f n
mapM_ putStrLn r
generateResultsAsStrings :: ([Bool] -> Bool) -> Int -> [String]
generateResultsAsStrings f n = map unwords $ map (\x -> (map show x ++ [show (f x)])) $ sequence $ replicate n [True, False]
infixl 4 `and'`
and' :: Bool -> Bool -> Bool
and' False _ = False
and' _ False = False
and' _ _ = True
infixl 4 `or'`
or' :: Bool -> Bool -> Bool
or' True _ = True
or' _ True = True
import Data.List (nub, group)
-- problem 31
isPrime :: Int -> Bool
isPrime n = length (filter (\x -> (mod n x) == 0) [2..n-1]) == 0 && n > 1
-- problem 32
pgcd :: Int -> Int -> Int
pgcd a 0 = a
pgcd a b = pgcd b (mod a b)
import Data.List (nub, group)
-- problem 31
isPrime :: Int -> Bool
isPrime n = length (filter (\x -> (mod n x) == 0) [2..n-1]) == 0 && n > 1
-- problem 32
pgcd :: Int -> Int -> Int
pgcd a 0 = a
pgcd a b = pgcd b (mod a b)