Skip to content

Instantly share code, notes, and snippets.

View danielfttorres's full-sized avatar

Daniel Torres danielfttorres

  • Sao Paulo, Brazil
View GitHub Profile
import React from 'react';
import {storiesOf} from '@kadira/storybook';
import mockRelay from '@loggi/js/mocks/relay';
import {Component} from '../';
import viewer from './fixtures/viewer'; // json data
const relay = {
variables: {
foo: {},
bar: true,
// Json code snippet response
// WRONG
$http.post(URL + '/subscribe', { "email": "test@email.com" })
// RIGHT
$http({
url: URL + '/subscribe',
method: "POST",
data: { "email": "test@email.com" },
headers: {'Content-Type': 'application/x-www-form-urlencoded' }
})
db.search(query, params, function(err, data) { // Busca de Vinyls na API Externa.
var discogsVinyls = data.results.map(function(item) { // `map` para selecionar as propriedades que quero.
var item = {
slug: slug(item.title).toLowerCase(),
discogsId: item.id,
cover: item.thumb || null,
title: item.title,
artists: item.artists || null,
genre: item.genre,
@danielfttorres
danielfttorres / multer-to-s3.js
Created November 15, 2015 01:05 — forked from adon-at-work/multer-to-s3.js
Sample File Upload From Multer to S3
var AWS = require('aws-sdk'),
fs = require('fs');
// http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html#Credentials_from_Disk
AWS.config.loadFromPath('./aws-config.json');
// assume you already have the S3 Bucket created, and it is called ierg4210-shopxx-photos
var photoBucket = new AWS.S3({params: {Bucket: 'ierg4210-shopxx-photos'}});
function uploadToS3(file, destFileName, callback) {
#!/bin/bash
# Put this in /hooks/after_prepare/
PLIST=platforms/ios/*/*-Info.plist
cat << EOF |
Add :NSAppTransportSecurity dict
Add :NSAppTransportSecurity:NSAllowsArbitraryLoads bool YES
Add :NSAppTransportSecurity:NSExceptionDomains:facebook.com:NSIncludesSubdomains bool YES
Add :NSAppTransportSecurity:NSExceptionDomains:facebook.com:NSThirdPartyExceptionRequiresForwardSecrecy bool NO
-- Acess MySQL with root
mysql -u root
-- Acess MySQL with a user
mysql -u your_username -p p4sw0rd
-- Display all databases
SHOW DATABASES;
-- Create a database
@danielfttorres
danielfttorres / media-queries.scss
Created September 18, 2014 04:42
Bootstrap Media Queries
@media (max-width: $screen-xs-max) {
/* Phone */
}
@media (min-width: $screen-sm-min) and (max-width: $screen-sm-max) {
/* Tablet */
}
@media (min-width: $screen-md-min) and (max-width: $screen-md-max) {
/* Desktop */
}
@media (min-width: $screen-lg-min) {