Skip to content

Instantly share code, notes, and snippets.

@bhameyie
bhameyie / haproxy.cfg
Last active November 28, 2023 22:30
Sample haproxy config
##based on Mesosphere Marathon's servicerouter.py haproxy config
global
daemon
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
maxconn 4096
tune.ssl.default-dh-param 2048
defaults
@bhameyie
bhameyie / SourceCodeGenerator.scala
Last active July 1, 2020 20:47
Only generate tables for a single schema
import slick.codegen.SourceCodeGenerator
import slick.jdbc.JdbcProfile
import slick.model.Model
import scala.concurrent.{Await, ExecutionContext}
import scala.concurrent.duration.Duration
object SourceCodeGenerator {
@bhameyie
bhameyie / ModuleExtensions.cs
Last active April 16, 2020 05:05
An extension to render view as string with NancyFx
using System.IO;
using Nancy;
using Nancy.ViewEngines;
namespace Web.Modules
{
public static class ModuleExtensions
{
public static string RenderRazorViewToString(this NancyModule module, string viewName, object model)
{
@bhameyie
bhameyie / Build.scala
Last active January 12, 2018 14:45
Casbah tutorial (sort of)
// Add salat and casbah to your build.scala or build.sbt files.
object ElBuild extends Build {
val Organization = "your own"
val Version = "0.0.1-SNAPSHOT"
val ScalaVersion = "2.10.3"
val ScalatraVersion = "2.2.1"
resolvers += "Maven Central Server" at "http://repo1.maven.org/maven2"
resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
@bhameyie
bhameyie / halFormBuilder.js
Created May 1, 2017 12:13
Rendering HAL Extension
function buildForm(containerId,obj) {
if (!obj["_presentable"]) {
return;
}
var presentable = obj["_presentable"];
var links = obj["_links"];
var form = document.createElement("form");
@bhameyie
bhameyie / All.cs
Created May 1, 2017 12:11
Sample description of HAL extension idea
public enum LinkKind
{
Fetch,
Save,
Update
}
public enum Restrictions
{
Required,
@bhameyie
bhameyie / gist:5666748
Created May 28, 2013 22:48
Nuget with albacore
def readVersion(filepath="AssemblyInfo.cs")
File.open(filepath).each_line{ |line|
if line.start_with?("[assembly: AssemblyVersion(\"")
return line.gsub("[assembly: AssemblyVersion(\"", "").gsub("\")]","").gsub(/\s+/, "")
end
}
end
//NOTE: written in older version of Swift back in January 2015. Swift has since changed a bit.
import Foundation
import UIKit
class UploadViewController: UIViewController,CLUploaderDelegate
{
@IBOutlet weak var capturedImage: UIImageView!
var Cloudinary:CLCloudinary!
var image:UIImage?
@bhameyie
bhameyie / gist:8411519
Created January 14, 2014 01:31
Fix for Git error: RPC failed; result=22, HTTP code = 411
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = false
[remote "origin"]
url = https://iamnotyou@bitbucket.org/iamnotyou/le-large-projet.git
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using ServiceStack.ServiceHost;
namespace Common
{
public interface IComposobaleBootstrapper