Skip to content

Instantly share code, notes, and snippets.

@dashr
dashr / tumblr.caman.bfly.xing.js
Created September 2, 2012 00:34
CamanJS greyscale + trans png overlay on all post images
<script type="text/javascript">
$(document).ready(function(){
$('.photo img').each(function() {
Caman( this, function () {
this.greyscale();
this.newLayer(function () {
this.setBlendingMode('normal');
this.opacity(100);
@dashr
dashr / gulpfile.js
Created October 3, 2016 00:27 — forked from plasticbrain/gulpfile.js
gulp.js task to deploy code to remote servers
/*******************************************************************************
* Description:
*
* Gulp file to push changes to remote servers (eg: staging/production)
*
* Usage:
*
* gulp deploy --target
*
* Examples:
@dashr
dashr / bucket_policy.js
Created March 27, 2016 02:22
S3 public read bucket policy
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadForGetBucketObjects",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::BUCKETNAME/*"
}
@dashr
dashr / policy.js
Last active March 27, 2016 02:20
aws s3 writer
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::BUCKETNAME"
@dashr
dashr / gist:e6d353b5d9b086595696
Created March 25, 2015 20:53
SSL Bundle Maker
cat STAR_yourdomain_ext.crt COMODORSADomainValidationSecureServerCA.crt COMODORSAAddTrustCA.crt AddTrustExternalCARoot.crt > star.yourdomain.crt
@dashr
dashr / gist:bd58b42bd21d27865558
Created March 25, 2015 20:50
nginx file cache
##
# File Cache Settings
##
open_file_cache max=5000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
fastcgi_cache_path /var/cache/nginx levels=1:2 keys_zone=microcache:10m max_size=1000m inactive=60m;
@dashr
dashr / nginx80-443
Last active January 20, 2016 06:40
Nginx: Send all 80 to 443
# /etc/nginx/sites-available/production <-- in same VirtualHost container as the 443 one, above it
server {
listen 80;
server_name sample.com www.sample.com;
rewrite ^(.*) https://sample.com$1 permanent;
}
@dashr
dashr / tags.tumblr.js
Created September 2, 2012 00:27
Hide the tumblr forced "submission" tag
<script type="text/javascript">
$(document).ready(function() {
//hide the tumblr forced "submission" tag, only City (1)
$(".tag_body:contains('submission')").parent().remove();
});
</script>
@dashr
dashr / d6_form_snippets.php
Created April 6, 2011 20:17
seldom used form snippets
$hooks['user_profile_form'] = array(
'arguments' => array('form' => NULL)
);
function theme_user_profile_form($form) {}
if ($vars['menu_item']['map'][0]=='user') {
if ($vars['menu_item']['map'][2]=='edit') {
drupal_goto('trainings') ; #var_dump($_GET);
}
@dashr
dashr / simple drupal6_paywall.php
Created April 6, 2011 20:22
simple drupal6 paywall
/**
* Determine if this is a premium user with special access to content
*
* @param $user
* Bring in the user object to test its roles
* @return boolean
* True if this is a premium user
*/
function is_Premium($user) {