Skip to content

Instantly share code, notes, and snippets.

View srdjan's full-sized avatar

⊣˚∆˚⊢ srdjan

View GitHub Profile
@creationix
creationix / sample.js
Last active December 18, 2015 12:39
Low Level JS API for local git repos
var gitRepo = require('../.');
var fs = require('min-fs');
var run = require('gen-run');
var consume = require('../stream-to-string.js');
run(function* main() {
// Configure the repo API to work from a local clone.
var repo = gitRepo({ fs: fs("./my-repo") });
defmodule ApplicationRouter do
use Dynamo.Router
prepare do
# Pick which parts of the request you want to fetch
# You can comment the line below if you don't need
# any of them or move them to a forwarded router
conn.fetch([:cookies, :params])
end
@dtchepak
dtchepak / BorrowABook.fs
Last active December 26, 2015 14:49
Trying to port Liam's simplified controller example to F#: http://withouttheloop.com/articles/2013-10-20-are-we-doing-mvc-wrong/ Untested.
module BorrowABook =
type BookLoanProblem =
NotInCatalogue
| OutOnLoan
| InsufficientPermission
| Failed of string
type Book = Book
type BookModel = BookModel
@staltz
staltz / introrx.md
Last active May 3, 2024 13:00
The introduction to Reactive Programming you've been missing
@paulallies
paulallies / gist:0052fab554b14bbfa3ef
Last active November 12, 2023 23:00
Remove node_modules from git repo
#add 'node_modules' to .gitignore file
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin <branch-name>
var If = React.createClass({
render: function() {
return this.props.value && this.props.children;
}
});
// usage
<If value={this.state.whatever}>
Stuff
</If>
namespace FSharp.Data
open Microsoft.FSharp.Core.CompilerServices
open ProviderImplementation.ProvidedTypes
open System.Reflection
module internal HexParser =
open System.Text.RegularExpressions
let private getHexVal (hex: char) =
require ('./globals')(global); // Mixed in Ramda to global here
var Task = require ('data.future'),
M = require ('control.monads'),
State = require ('fantasy-states'),
Reader = require ('fantasy-readers'),
Tuple2 = require ('fantasy-tuples').Tuple2,
Maybe = require ('data.maybe'),
ST = State.StateT (Task),
App = Reader.ReaderT (ST);
//scala
vertx.createHttpServer().requestHandler({ req: HttpServerRequest =>
req.response()
.putHeader("Content-Type", "text/html")
.end("<html><body><h1>Hello from Vert.x!" +
"</h1></body></html>")
}).listen(8080)
//groovy
vertx.createHttpServer().requestHandler({ req ->
@th3hunt
th3hunt / dashboard.js
Last active October 16, 2017 15:12
Chain PageObject methods with Intern.js, by having each PageObject instance using a new/enriched remote Command
define(function (require) {
var Page = require('./base/page')
, _ = require('vendor/lodash/lodash.underscore');
function DashboardPage() {
Page.apply(this, arguments);
}
DashboardPage.prototype = Object.create(Page.prototype);