Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Pedro Costa plcosta

🎯
Focusing
View GitHub Profile
View api_index.js
// api/index.js
import Request from 'superagent'
export const getUser (userId) {
return Request
.get('/api/user/:userId');
}
@crot4lus
crot4lus / facebook-to-disqus.php
Created Sep 11, 2014
Import Facebook comments to Disqus
View facebook-to-disqus.php
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dsq="http://www.disqus.com/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:wp="http://wordpress.org/export/1.0/"
>
<channel>
<?php
error_reporting(0);
@ozgun
ozgun / boolean_store_accessor.rb
Last active Jun 1, 2017
Using ActiveRecord::Store to store boolean fields
View boolean_store_accessor.rb
# File: app/models/concerns/boolean_store_accessor.rb
#
# When we submit a form in order to update a model, a booelan/checkbox field is posted
# as '1' or '0', and if we are using ActiveRecord::Store, posted value is stored in
# database as '1' or '0'. By the help of this module, we store '1' and '0'
# values as `true` or `false`.
#
# Example usage:
#
# ```
View readme.md
  1. Go to Deployment Hooks -> Clone new release -> After this action -> Add Hook and add this line:
ln -s {{project}}/storage/wp-config.php {{release}}/wp-config.php
  1. Add this configuration under Linked Folders:
wp-content/uploads -> storage/wp-content/uploads	
@iloveitaly
iloveitaly / graffle2hash.rb
Created Dec 16, 2011
Convert Hierarchical OmniGraffle Document to JSON
View graffle2hash.rb
#!/usr/bin/env ruby
# rubycocoa
require 'osx/cocoa'
include OSX
OSX.require_framework 'ScriptingBridge'
class GraffleConverter
def initialize
@graffle = SBApplication.applicationWithBundleIdentifier_("com.omnigroup.OmniGraffle")
@bondario
bondario / ubuntu1204_php54
Created Aug 9, 2013
Downgrade php 5.5 to 5.4 or keep php 5.4 for Ubuntu 12.04.02 LTS
View ubuntu1204_php54
apt-get install -y ppa-purge
add-apt-repository -y ppa:ondrej/php5-oldstable
apt-get update
ppa-purge ppa:ondrej/php5
apt-get update && apt-get upgrade -y && apt-get autoremove -y && apt-get autoclean -y
@henrik
henrik / heroku_db_to_dokku_psql_single_container.sh
Last active Oct 30, 2018
Copying a Heroku DB to dokku-psql-single-container.
View heroku_db_to_dokku_psql_single_container.sh
cd my_heroku_app
# Make sure DB doesn't update on Heroku. This may be enough depending on your needs.
heroku maintenance:on
# Dump from Heroku.
heroku pg:pull DATABASE_URL heroku_dump
pg_dump heroku_dump -Fc > /tmp/db.dump # Fc for binary dump (otherwise the import will complain)
# Restore to Dokku.
@puredazzle
puredazzle / webpack.mix.js
Last active Dec 21, 2018
Advanced Laravel Mix setup for WordPlate - https://github.com/wordplate/wordplate
View webpack.mix.js
const mix = require('laravel-mix');
const resources = 'resources/assets';
const themePath = 'public/themes/wordplate';
const assetsPath = `${themePath}/assets`;
mix.setPublicPath(assetsPath);
mix.setResourceRoot('../');
mix.browserSync({
@twoism-dev
twoism-dev / git.md
Last active Mar 13, 2019
Hybrid Git Flow
View git.md

Our Git Flow

We are using a simple git flow based on git flow and github flow. We have two branches develop and master.

develop is a representation of staging

master is a representation of production

The Rules

@dasDaniel
dasDaniel / vue-test-utils-helpers.js
Last active Mar 26, 2019
helper functions for vue-test-utils
View vue-test-utils-helpers.js
function withWrapperArray(wrapperArray) {
return {
childSelectorHasText: (selector, str) => wrapperArray.filter(i => i.find(selector).text().match(str)),
hasText: (str) => wrapperArray.filter(i => i.text().match(str)),
areVisible: () => wrapperArray.wrappers.filter(w => w.isVisible()).length,
areHidden: () => wrapperArray.wrappers.filter(w => !w.isVisible()).length,
areAllVisible: () => wrapperArray.wrappers.every(w => w.isVisible()),
areAllHidden: () => wrapperArray.wrappers.every(w => !w.isVisible()),
}
}
You can’t perform that action at this time.