Skip to content

Instantly share code, notes, and snippets.

View passy's full-sized avatar
😷
Wear a mask.

Pascal Hartig passy

😷
Wear a mask.
View GitHub Profile
@stephenplusplus
stephenplusplus / retry-failed-route.js
Created February 19, 2014 18:51
Angular API re-attempt
angular
.module('app')
.config(function ($httpProvider) {
$httpProvider.interceptors.push(['$injector', '$q', function ($injector, $q) {
return {
responseError: function (rejection) {
var $http = $injector.get('$http'),
$state = $injector.get('$state'),
MAX_RETRY_ATTEMPTS = 2,
request = rejection.config,
var crypto = require("crypto")
var User = function(attributes) {
this._attributes = attributes || {}
}
User.KEY_LENGTH = 32
User.WORK_FACTOR = 20000
User.prototype.setPassword = function(password, callback) {
//! Leveraging tuples to make a statically typed, concatenative EDSL in Rust.
//!
//! I'm not sure how practical it really is – Rust's syntax can make it a little
//! hard to read, but it's fun to play around with it. The neat thing is how
//! little copying occurs. Everything is moved in and out by-value in a pipeline.
//!
//! Thanks goes to [Tekmo on reddit](http://www.reddit.com/r/programming/
//! comments/1zzom4/using_functionlength_to_implement_a_stack_language/cfyibsr)
//! for the idea.
//!
@toshok
toshok / gist:21a8100a1d9e5626f57e
Created May 31, 2014 22:08
ejs hello world on 64 bit linux
toshok@ubuntu:~/src/echo-js/test$ cat hello-world.js
console.log("hello world!");
toshok@ubuntu:~/src/echo-js/test$ ../ejs --target linux_amd64 hello-world.js
COMPILE hello-world.js
LINK hello-world.js.exe
done.
toshok@ubuntu:~/src/echo-js/test$ file hello-world.js.exe
hello-world.js.exe: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=c1d04704e87bbc85a398160e9125c2864b2da659, not stripped
toshok@ubuntu:~/src/echo-js/test$ ./hello-world.js.exe
hello world!
@btford
btford / chillax.md
Created October 30, 2014 06:59
Why you shouldn't worry so much about migrating with Angular

Several developers asked me about how difficult it will be to migrate Angular 1 to Angular 2. Angular 2 isn't done, so I legitimately have no idea how hard it will be. But there are a few high-level guiding principals in the design of Angular 1 that make adapting to changes like this fairly painless.

Angular 1 was designed so it would have a fairly minimal API surface. Let's look at controllers, since these are the meat of your app. Controllers are just functions that get passed other components as arguments:

MyController ($scope) {
  $scope.list = [];
  
  $scope.addItem = function (name) {
    $scope.list.push({
@paf31
paf31 / memo.purs
Created December 16, 2014 01:47
Memoized functions in PureScript
module Main where
import Debug.Trace
import Data.Tuple
import Data.Either
import Data.Lazy
class Memo a where
memo :: forall r. (a -> r) -> a -> Lazy r
var Style = React.createClass({
render: function() {
var style = assign({}, this.props);
delete style.children;
return React.createElement(
'div',
{style: style, children: this.props.children}
);
}
@triblondon
triblondon / README.md
Last active August 29, 2015 14:13
Edge conf 5: London 2015

#Early draft of Edge conf 5

This was a discussion of the schedule for Edge 5, which is now finalised, and the information below is out of date. See the website for current details.

##Format

Edge 5 will feature a single track of 4 sequential panel discussions on topics of universal importance and topicality to the web community, followed by lunch and then 12 breakout sessions across 4 tracks, in which face to face discussions of specific current and future web topics can be had in boardroom style with groups of up to 50.

class Foo[A]
trait Bar[A] extends Foo[A]
class Baz[A] extends Foo[A] with Bar[A]
------------------------------------------------------------------------------------------
-- A formalization of the Cheryl's birtday problem; using Haskell/SBV
--
-- See: http://www.nytimes.com/2015/04/15/science/a-math-problem-from-singapore-goes-viral-when-is-cheryls-birthday.html
--
-- By Levent Erkok, This file is in the public domain. Use it as you wish!
--
-- NB. Thanks to Amit Goel for suggesting the formalization strategy used in here.
------------------------------------------------------------------------------------------