Skip to content

Instantly share code, notes, and snippets.

Avatar
🤖
Beep Boop

Adrian Rangel acrogenesis

🤖
Beep Boop
View GitHub Profile
View board.ex
defmodule Board do
alias IslandsEngine.{Coordinate, Island}
def position_island(board, key, %Island{} = island) do
case overlaps_existing_island?(board, key, island) do
true -> {:error, :overlapping_island}
false -> Map.put(board, key, island)
end
end
@acrogenesis
acrogenesis / lvh_ssl.md
Last active Jan 11, 2018 — forked from dagjaneiro/lvh_ssl.md
lvh.me ssl
View lvh_ssl.md

Install nginx

$ brew install nginx

Edit nginx.conf

$ vim /usr/local/etc/nginx/nginx.conf
@acrogenesis
acrogenesis / gulpfile.js
Created Jun 21, 2017
BrowserSync with rails/gulp
View gulpfile.js
gulp.task('server', function() {
browserSync.init({
proxy: {
target: 'localhost:3000',
reqHeaders: function () {
return { host: 'localhost:8000' };
}
},
port: 8000,
open: true,
View hacks htaccess
Well i didn't see any thread about this so let's start one :DRINK:
Specify the Directory Index:
DirectoryIndex newindex.html
Specify 404 error:
ErrorDocument 404 /404error.html
Redirect 301
Redirect 301 /old.html /new.html
@acrogenesis
acrogenesis / toMySqlDate.js
Last active Aug 29, 2015
javascript Date toMySqlDate
View toMySqlDate.js
d = new Date(); // => Thu Feb 26 2015 22:16:14 GMT-0600 (CST)
d.toMySQLDateTime(); // => 2015-02-26 22:16:14
Date.prototype.toMySQLDateTime = function () {
function addZ(n) {
return (n<10? '0' : '') + n;
}
return this.getFullYear() + '-' +
addZ(this.getMonth() + 1) + '-' +
addZ(this.getDate()) + ' ' +
View timestamp_client.html
<html>
<head>
<title>Timestamp</title>
</head>
<script>
var myTimer;
function getTime(){
var xmlhttp;
var span;
if (window.XMLHttpRequest)
@acrogenesis
acrogenesis / application_helper.rb
Created Jan 6, 2015
Foundation display_flash_messages, supports single and array flash messages
View application_helper.rb
module ApplicationHelper
DEFAULT_KEY_MATCHING = {
alert: :alert,
notice: :success,
info: :standard,
secondary: :secondary,
success: :success,
error: :alert,
warning: :warning
}
@acrogenesis
acrogenesis / getWeather.sh
Last active Aug 29, 2015
How to bypass api restrictions
View getWeather.sh
#!/bin/bash
cd /home/user/pathto/weatherapi
wget -O http://api.wunderground.com/api/heregoeskey/forecast/lang:SP/q/Mexico/Monterrey.json
@acrogenesis
acrogenesis / 0_reuse_code.js
Created Jan 30, 2014
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
You can’t perform that action at this time.