Skip to content

Instantly share code, notes, and snippets.

@beanmoss
beanmoss / nginx.conf
Created Aug 30, 2018 — forked from thoop/nginx.conf
Official prerender.io nginx.conf for nginx
View nginx.conf
# Change YOUR_TOKEN to your prerender token and uncomment that line if you want to cache urls and view crawl stats
# Change example.com (server_name) to your website url
# Change /path/to/your/root to the correct value
server {
listen 80;
server_name example.com;
root /path/to/your/root;
index index.html;
@beanmoss
beanmoss / README-Template.md
Created Aug 7, 2017 — forked from PurpleBooth/README-Template.md
A template to make good README.md
View README-Template.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@beanmoss
beanmoss / fb-sytax-highlight.js
Created Jul 29, 2016
hightlight fb script posts
View fb-sytax-highlight.js
MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
syntaxHighlight();
var observer = new MutationObserver(function (mutations, observer) {
syntaxHighlight();
});
observer.observe(document, {
subtree: true,
attributes: true
});
function syntaxHighlight() {
View AhmedMehar.php
<table border="1">
<?php
$aVeryLongWord = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad';
$chunks18 = str_split($aVeryLongWord,18);
foreach($chunks18 as $chunk)
{
echo "<tr>";
$oneChar = str_split($chunk,1);
foreach($oneChar as $char)
@beanmoss
beanmoss / email.template.html
Created Jun 1, 2016
email template replace vars meteor
View email.template.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
%val1% %val2%
</body>
</html>
@beanmoss
beanmoss / nginxproxy.md
Created Apr 18, 2016 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?
View nginxproxy.md

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@beanmoss
beanmoss / dBoxReadFile.js
Created Apr 14, 2016
Dropbox read file and serve it to the browser.
View dBoxReadFile.js
var Dropbox = require("dropbox");
var fs = require("fs");
var config = require('../config');
var client = new Dropbox.Client(config.dropbox);
getFile: function (file, res) {
client.readFile(file,{ buffer: true }, function (error, result) {
if (error) {
console.log(error);
@beanmoss
beanmoss / IDONTFUCKINGCARE bookmarklet
Last active Jul 17, 2017
pangchurva ng aldub, pastillas, otwol sa facebook!
View IDONTFUCKINGCARE bookmarklet
javascript:(function()%7BMutationObserver%20%3D%20window.MutationObserver%20%7C%7C%20window.WebKitMutationObserver%3Bfilter%20%3D%20prompt(%22Dont%20want%20to%20see%20these%3A%22%2C%20%22aldub%7Cpastillas%7Cotwol%22)%3BiDontFuckingCare()%3Bvar%20observer%20%3D%20new%20MutationObserver(function%20(mutations%2C%20observer)%20%7BiDontFuckingCare()%3B%7D)%3Bobserver.observe(document%2C%20%7Bsubtree%3A%20true%2Cattributes%3A%20true%7D)%3Bfunction%20iDontFuckingCare()%20%7Bif%20(filter%20!%3D%20null)%20%7Bx%20%3D%20document.getElementsByClassName('fbUserContent')%3BregexFilter%20%3D%20new%20RegExp(filter%2C%20%22gi%22)%3Bfor%20(var%20i%20%3D%200%3B%20i%20%3C%20x.length%3B%20i%2B%2B)%20%7Bif%20(regexFilter.test(x%5Bi%5D.innerHTML))x%5Bi%5D.remove()%3B%7D%7D%7D%7D)()
View ubuntu-php-development-environment.md

#Introduction If you're a php developer on ubuntu, there comes the time where you have to install/reinstall your system. I did it already a few times and i decided to write down the steps for a typical web developer stack with php. This is for a developer machine and not for a live environment!

I hope it helps you too!

fyi @mheiniger and me started with an installer here: https://github.com/mheiniger/webdev-setup

@beanmoss
beanmoss / RestControllerTrait.php
Created Apr 18, 2015
Playing with Laravel Lumen: simple RESTful trait.
View RestControllerTrait.php
<?php namespace App\Http\Controllers;
use Illuminate\Http\Request;
trait RestControllerTrait
{
public function index()
{
$m = self::MODEL;
return $this->listResponse($m::all());