Skip to content

Instantly share code, notes, and snippets.

View princejwesley's full-sized avatar
💻
Available for Hire

Prince John Wesley princejwesley

💻
Available for Hire
View GitHub Profile
@princejwesley
princejwesley / ToggleDebug.elm
Last active May 27, 2016 02:23
[elm] Toggle on/off Debug.log
-- Toggle Debug.log
-- For non production use only
import Debug exposing(log)
-- (1) with |>
1 + 1 |> log "Addition" -- prints "Addition: 2" and returns 2
-- turn off logging
1 + 1 -- |> log "Addition"
@princejwesley
princejwesley / query.ex
Last active October 7, 2020 17:24
Minimal LINQ like Query for elixir
defmodule Enum.Query.CompileError do
@moduledoc ~S"""
Raise compile time error while building query
"""
defexception [:message]
end
defmodule Enum.Query do
@moduledoc ~S"""
@bishboria
bishboria / springer-free-maths-books.md
Last active June 8, 2024 06:39
Springer made a bunch of books available for free, these were the direct links
@princejwesley
princejwesley / gulp-angular-module-task.js
Created November 23, 2015 13:07
Gulp pipe-able function for creating angular modules only when its not already created
var through = require('through2');
var moduleWrapper = through.obj(function (chunk, enc, cb) {
var content = chunk._contents.toString();
var newContent = content.replace(/angular\s*\.\s*module\s*\(\s*['"]([^'"]+)['"]\s*,\s*\[([^\]]*)\][^)]*\)/mg, function(match, mod, deps) {
// ignore ngHtml2Js templates module name
// if(mod === 'app.templates') { return match; }
return "((function () {\n try {\n return angular.module('" + mod + "');\n } catch (e) {\n return angular.module('" + mod + "', [" + deps + "]);\n }\n})())";
});
chunk._contents = new Buffer(newContent);
@kanaka
kanaka / repl-node.js
Last active March 25, 2020 01:26
Standalone ClojureScript REPL
This file has been truncated, but you can view the full file.
#!/usr/bin/env node
var COMPILED = false;
var goog = goog || {};
goog.NODE_JS = true;
goog.global = goog.NODE_JS ? eval("global") : this;
goog.global.CLOSURE_UNCOMPILED_DEFINES;
goog.global.CLOSURE_DEFINES;
goog.isDef = function(val) {
return val !== void 0;
};
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active July 17, 2024 14:20
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@gclaramunt
gclaramunt / planes.scala
Created June 6, 2012 18:08
Very simple phantom types example
trait FlightStatus
trait Flying extends FlightStatus
trait Landed extends FlightStatus
case class Plane[Status <: FlightStatus]()
def land(p:Plane[Flying])=Plane[Landed]()
def takeOff(p:Plane[Landed])= Plane[Flying]()
val plane = new Plane[Landed]()