Skip to content

Instantly share code, notes, and snippets.

View nhc's full-sized avatar

Neil Charlton nhc

View GitHub Profile
<?php
//** Give this user access to kListOne and kListTwo
$iUser1 = kNew; // sets to 1
$iUser1 |= kListOne; // sets to 3
$iUser1 |= kListTwo; // sets to 7
//** Give this user access to kListTwo and k3rdPartyOptIn
$iUser2 = kNew; //sets to 1
$iUser2 |= kListTwo; //sets to 5
$iUser2 |= k3rdPartyOptIn; //sets to 13
<?php
define( "kNew", 1 );
define( "kListOne", 2 );
define( "kListTwo", 4 );
define( "k3rdPartyOptIn", 8 );
| 128| 64 | 32 | 16 | 8 | 4 | 2 | 1 |
--------------------------------------------------
kNew | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
kListOne | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |
kListTwo | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
k3rdPartyOptIn | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
---------------------------------------------------
| 128| 64 | 32 | 16 | 8 | 4 | 2 | 1 |
--------------------------------------------------
$iUser1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 |
kListOne | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |
----------------------------------------------------
| 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |
@nhc
nhc / SimpleGitWorkflow.sh
Created September 7, 2011 22:08
Simple Git Workflow
git clone git:...
git add path/to/new_file
git commit -a
git pull
git push
@nhc
nhc / dabblet.css
Created April 8, 2012 02:57
CSS Background Experiment
/**
* CSS Background Experiment
*/
background-color:white;
background-image:
radial-gradient(midnightblue 9px, transparent 10px),
repeating-radial-gradient(midnightblue 0, midnightblue 4px, transparent 5px, transparent 20px, midnightblue 21px, midnightblue 25px, transparent 26px, transparent 50px);
background-size: 30px 30px, 90px 90px;
background-position: 0 0;
@nhc
nhc / dabblet.css
Created April 20, 2012 03:08
Untitled
body {margin: 0; padding: 10px;}​
@nhc
nhc / paperclip_conditional_resize.rb
Last active December 17, 2015 13:58
For when you don't have imagemagick on your development machine for whatever reason. This goes in your rails model and only applies styles if your in the Production environment. Also uses some stored S3 credentials for AWS S3 storage.
class ModelName < ActiveRecord::Base
has_attached_file :avatar, :styles => lambda { |attachment| ( Rails.env.production? ) ? { :medium => "104x104", :small => "60x60" } : {} }, :storage => :s3, :s3_credentials => "#{Rails.root}/config/s3.yml", :path => "/:style/:id/:filename"
end
UPDATE wp_options SET option_value = replace(option_value, 'http://www.old-domain.com', 'http://www.new-domain.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.old-domain.com', 'http://www.new-domain.com');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-domain.com', 'http://www.new-domain.com');
$(function(){
$.ajaxSetup({ cache: true });
$.getScript('//connect.facebook.net/en_US/sdk.js', function(){
FB.init({
appId: '{APP_ID}', // CHANGE APP_ID
version: 'v2.3' // or v2.1, v2.2, v2.3, ...
});
});
});