Skip to content

Instantly share code, notes, and snippets.

View pinceladasdaweb's full-sized avatar
👊
The only thing I really care about is user experience.

Pedro Rogério pinceladasdaweb

👊
The only thing I really care about is user experience.
View GitHub Profile
// HOPED-FOR BEHAVIOR: /cats says: Cats Home
// ACTUAL BEHAVIOR: /cats says: Main Wildcard
var express = require('express');
var app = express();
app.get('/', function(req, res) {
res.send('Main Home');
})
/**
* supplant() does variable substitution on the string. It scans through the string looking for
* expressions enclosed in { } braces. If an expression is found, use it as a key on the object,
* and if the key has a string value or number value, it is substituted for the bracket expression
* and it repeats.
*
* Written by Douglas Crockford
* http://www.crockford.com/
*/
String.prototype.supplant = function (o) {
<script>
const render = function (posts) {
posts.responseData.feed.entries.forEach((post, index) => {
console.log(post.title);
console.log(post.content);
console.log(post.link);
});
};
new Feeder({
@pinceladasdaweb
pinceladasdaweb / robot.js
Created December 4, 2012 17:17 — forked from fabiopimentel/robot.js
CSS no Lanche
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.clone();
robot.ahead(100);
@pinceladasdaweb
pinceladasdaweb / robot.js
Created December 4, 2012 17:14
Pinceladas da Web
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.clone();
@pinceladasdaweb
pinceladasdaweb / gist:5612973
Created May 20, 2013 15:31
Restricting File Type Before Uploading with JavaScript
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Restricting File Type Before Uploading with JavaScript</title>
</head>
<body>
<input type="file" name="upload" id="upload">
var express = require('express');
var sys = require('util');
var oauth = require('oauth');
var app = express.createServer();
var _twitterConsumerKey = process.env['TWITTER_CONSUMER_KEY'];
var _twitterConsumerSecret = process.env['TWITTER_CONSUMER_SECRET'];
console.log("_twitterConsumerKey: %s and _twitterConsumerSecret %s", process.env['TWITTER_CONSUMER_KEY'], process.env['TWITTER_CONSUMER_SECRET']);
@pinceladasdaweb
pinceladasdaweb / cep.php
Created November 29, 2013 17:40
Convert XML to JSON
<?php
class XmlToJson {
public function Parse ($url) {
$fileContents= file_get_contents($url);
$fileContents = str_replace(array("\n", "\r", "\t"), '', $fileContents);
$fileContents = trim(str_replace('"', "'", $fileContents));
$simpleXml = simplexml_load_string($fileContents);
$json = json_encode($simpleXml);
return $json;
}
@pinceladasdaweb
pinceladasdaweb / index.html
Last active December 31, 2015 12:39
Hello World Firefox OS
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World Firefox OS (Primeira Aplicação)</title>
<link rel="stylesheet" href="css/main.css">
</head>
<body>
<article class="content">
<h1>Hello World <br>Firefox OS</h1>
@pinceladasdaweb
pinceladasdaweb / install-mongodb-mac-os-x.md
Created November 13, 2018 16:16 — forked from Sydney-o9/install-mongodb-mac-os-x.md
Install MongoDB on Mac OS X without brew

1. Download latest source

# Get latest from MongoDB website
$ curl -O https://fastdl.mongodb.org/osx/mongodb-osx-x86_64-3.4.6.tgz
$ tar -zxvf mongodb-osx-x86_64-3.4.6.tgz
$ mkdir -p mongodb
$ cp -R -n mongodb-osx-x86_64-3.4.6/ mongodb
$ sudo mv mongodb /usr/local