Skip to content

Instantly share code, notes, and snippets.

@jaenmedina
jaenmedina / simple_facebook_api_wrapper.js
Last active October 24, 2015 19:44
A simple facebook api wrapper I've been using for a couple of projects
/**
* This is called when the response is positive (for example when the status is 'connected').
* @callback successCallback
*/
/**
* This is called when the response is negative (for example when the status is not 'connected').
* @callback failureCallback
*/
RewriteRule ^dashboard/(.*) wp-admin/$1?%{QUERY_STRING} [L]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
<?php
/**
* Custom queries and getters.
*
* @package WDS8
*/
/**
* Get two most recent posts.
*
@davemac
davemac / gist:1297140
Created October 19, 2011 00:16
WordPress query taxonomy by meta key and value
<?php
$myquery = array(
'tax_query' => array(
array(
'taxonomy' => 'productcat',
'terms' => array('equip', 'pro-rack', 'slat-tech', 'acrylics' , 'i60-system' , 'prestige', 'shop-x', 'shopfitters'),
'field' => 'slug'
)
),
'order' => 'ASC',
@DinisCruz
DinisCruz / Version 1 (with static data).cs
Last active October 26, 2017 21:09
O2 Script - Send data to Google Analytics via get request (of Image)
//descriptions from http://www.lunametrics.com/blog/2011/10/04/utmgif-request-parameters/
var utmwv = "5.3.8"; // Tracking code version
var utms = "1"; // Session requests. Updates every time a __utm.gif request is made. Stops incrementing at 500 (max number of GIF requests per session).
var utmn = "1797201820"; // Unique ID generated for each GIF request to prevent caching of the GIF image
var utmhn = "teammentor-33-ci"; // Host name, which is a URL-encoded string
var utmcs = "ISO-8859-1"; // Language encoding for the browser. Some browsers don’t set this, in which case it is set to “-”
var utmsr = "1440x852"; // Screen resolution
var utmvp = "1440x751"; // Size of Viewing Pane
var utmsc = "32-bit"; // Screen color depth
var utmul = "en-us"; // Browser language
@j3ffgray
j3ffgray / ffffound.com.js
Created March 30, 2012 21:24
Pinterested ffffound using dotjs
/**
* jQuery Masonry v2.1.03
* A dynamic layout plugin for jQuery
* The flip-side of CSS Floats
* http://masonry.desandro.com
*
* Licensed under the MIT license.
* Copyright 2011 David DeSandro
*/
(function(a,b,c){"use strict";var d=b.event,e;d.special.smartresize={setup:function(){b(this).bind("resize",d.special.smartresize.handler)},teardown:function(){b(this).unbind("resize",d.special.smartresize.handler)},handler:function(a,b){var c=this,d=arguments;a.type="smartresize",e&&clearTimeout(e),e=setTimeout(function(){jQuery.event.handle.apply(c,d)},b==="execAsap"?0:100)}},b.fn.smartresize=function(a){return a?this.bind("smartresize",a):this.trigger("smartresize",["execAsap"])},b.Mason=function(a,c){this.element=b(c),this._create(a),this._init()},b.Mason.settings={isResizable:!0,isAnimated:!1,animationOptions:{queue:!1,duration:500},gutterWidth:0,isRTL:!1,isFitWidth:!1,containerStyle:{position:"relative"}},b.Mason.prototype={_filterFindBricks:function(a){var b=this.options.itemSelector;return b?a.filter
@justb3a
justb3a / nginx conf
Last active February 6, 2018 14:14
nginx
# redirects
server {
listen 80; # 443
# ssl
root /xxx/public;
server_name domain.org;
@stephenyeargin
stephenyeargin / referer-spam.md
Last active August 31, 2018 13:41
NGINX referral spam blocking

Following this guide + data from this page

File: /etc/nginx/global/referer-spam.conf

##
# Referrer exclusions
##
if ($http_referer ~ "(buttons-for-website\.com|darodar\.com|econom\.co|ilovevitaly\.co|kambasoft\.com|lumb\.co|7makemoneyonline\.com|ranksonic\.info|savetubevideo\.info|see-your-website-here\.com|semalt\.com|priceg\.com|srecorder\.com|descargar-musica-gratis\.net|54\.186\.60\.77|lomb\.co)") {
  set $prohibited "1";
@chestozo
chestozo / tumblr.api.post.text.js
Created September 2, 2012 08:25
Tumblr API usage with OAuth: creating a text post
var oauth = ChromeExOAuth.initBackgroundPage({
'request_url': 'http://www.tumblr.com/oauth/request_token',
'authorize_url': 'http://www.tumblr.com/oauth/authorize',
'access_url': 'http://www.tumblr.com/oauth/access_token',
'consumer_key': 'vGKikr2uBRsWoDZ947UjvSzA58HYEXDNjAer7VEXnLXlQt4Ozi',
'consumer_secret': 'JvofKKxQ2QSiVXVaWMBZQRzC5cI86YpJzAoouIkUdlvSeYXN2e',
'app_name': 'Photo post adder'
});
function stringify(parameters) {
@nodesocket
nodesocket / gist:3909074
Created October 17, 2012 23:53
Benchmark of for vs foreach in PHP
<?php
$elements = array();
////
// An array of 10,000 elements with random string values
////
for($i = 0; $i < 10000; $i++) {
$elements[] = (string)rand(10000000, 99999999);
}