Skip to content

Instantly share code, notes, and snippets.

View emanuelpessoaa's full-sized avatar

Emanuel Pessoa emanuelpessoaa

  • João Pessoa, PB
View GitHub Profile
// Fonts mixin
font-url(file)
return '../fonts/' + file
webfont(family, file, hack-chrome-windows = false, weight = 'normal')
@font-face
font-family family
src url(font-url(file + '.eot'))
src url(font-url(file + '.eot?#iefix')) format('embedded-opentype'),
url(font-url(file + '.woff')) format('woff'),
@emanuelpessoaa
emanuelpessoaa / osx-mongodb-rlimits-fix.md
Created February 28, 2016 17:03 — forked from tamitutor/osx-mongodb-rlimits-fix.md
Fix Mongodb "soft rlimits" Warning On Mac OS X (Yosemite)

If you are seeing Mongo soft rlimits warnings in your logs, or a WARNING: soft rlimits too low. Number of files is 256, should be at least 1000 when you login to mongo shell via mongo from the commandline, or any mysterious/unexplained mongo connection errors... follow this how-to exactly and it will resolve the issue for you.

(Source of this how to found at basho/basho_docs#1402)

First file: sudo vi /Library/LaunchDaemons/limit.maxfiles.plist

...containing:

<?php $args = array(
'numberposts' => -1,
'offset' => 0,
'orderby' => 'post_date',
'order' => 'DESC',
'post_type' => 'custom_post_type_here',
'post_status' => 'publish',
'meta_query' => array(
array(
'key' => 'custom_field_key_name',
<?php /* This function attaches the image to the post in the database, add it to functions.php */
function insert_attachment($file_handler,$post_id,$setthumb='false') {
// check to make sure its a successful upload
if ($_FILES[$file_handler]['error'] !== UPLOAD_ERR_OK) __return_false();
require_once(ABSPATH . "wp-admin" . '/includes/image.php');
require_once(ABSPATH . "wp-admin" . '/includes/file.php');
require_once(ABSPATH . "wp-admin" . '/includes/media.php');
<?php
// Max size in KB
define('MAX_SIZE', '100');
$errors = 0;
if (isset($_POST['Submit'])) {
$image = $_FILES['image']['name'];
if ($image) {
$fileName = strtolower(pathinfo($image, PATHINFO_FILENAME));
<?php
$page = $_SERVER['PHP_SELF'];
$column = 5;
$base = "data";
$thumbs = "thumbs";
$get_album = $_GET['album'];
if (!$get_album) {
$(document).ready(function(){
// alert('ready');
var moviehash;
$('form').on('submit', function(event){
// alert('submit');
event.preventDefault();
var form = $(this);
//Your frontend javascript
var data = {
action: 'sign_in',
username:"<username>",
pass:"<password>"
};
jQuery.post('/wordpress/wp-admin/admin-ajax.php', data,
function(response) {
alert("signed in successfully");
<?php /* This function attaches the image to the post in the database, add it to functions.php */
function insert_attachment($file_handler,$post_id,$setthumb='false') {
// check to make sure its a successful upload
if ($_FILES[$file_handler]['error'] !== UPLOAD_ERR_OK) __return_false();
require_once(ABSPATH . "wp-admin" . '/includes/image.php');
require_once(ABSPATH . "wp-admin" . '/includes/file.php');
require_once(ABSPATH . "wp-admin" . '/includes/media.php');