Skip to content

Instantly share code, notes, and snippets.

🎹
Techno Techno Techno Techno Techno Techno Techno Techno Techno Techno Techno

Neil Charlton nhc

🎹
Techno Techno Techno Techno Techno Techno Techno Techno Techno Techno Techno
Block or report user

Report or block nhc

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@nhc
nhc / example-bad.php
Last active Aug 23, 2018
This does not work
View example-bad.php
<?php
$number = 5000;
$filter['email_1'] = ['$exists' => 1];
$mongoRequest = new MongoRequest();
$mongoRequest->setFilter($filter);
$mongoRequest->setLimit($number);
$importContactModel = new ImportContactModel();
@nhc
nhc / alias-docker-compose.sh
Created Feb 28, 2018 — forked from maxcnunes/alias-docker-compose.sh
Aliases for docker-compose
View alias-docker-compose.sh
alias c='docker-compose'
alias cb='docker-compose build'
alias cup='docker-compose up'
alias cr='docker-compose run --service-ports --rm'
alias crl='docker-compose run --service-ports --rm local'
alias crd='docker-compose run --service-ports --rm develop'
alias crt='docker-compose run --rm test'
alias crp='docker-compose run --rm provision'
alias crci='docker-compose run --rm ci'
alias crwt='docker-compose run --rm watchtest'
View usefulmongo.db
// copy collection (FAST)
db.myoriginal.aggregate([ { $match: {} }, { $out: "mycopy" } ])
@nhc
nhc / import-docker.sh
Last active Feb 20, 2018
Import CSV Into Docker
View import-docker.sh
$ docker cp /Users/developer/Downloads/lists-data.csv apimkmbscouk_mongodb_1:/home/
$ docker-compose exec mongodb mongoimport -d mkmdev -c lists_old --type csv --file /home/lists-data.csv --headerline
## In order to force the fields to be of a datatype (for leading zero's on columnns) chanmge to the following
docker-compose exec mongodb mongoimport -d mkmdev -c lists_old --type csv --file /home/lists-data.csv --columnsHaveTypes --fields "AccountNo.string(),AccountName.string(),WishListName.string(),Created.string(),SKU.string(),ProductTitle.string(),Quantity.int32()"
@nhc
nhc / index.html
Last active Jun 14, 2017
Simple JS promise.
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<script src="https://cdnjs.cloudflare.com/ajax/libs/bluebird/1.2.2/bluebird.js"></script>
<title>JS Bin</title>
</head>
<body>
@nhc
nhc / main.js
Created May 8, 2017
Demo method of changing classes assigned to tools
View main.js
var link_obj = {
"lnk-ps coming-soon" : "absolute_path_to_file.docx",
}
View fb-graph-reactions.js
$(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, ...
});
});
});
View mysql_wordpress_move.sql
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');
@nhc
nhc / paperclip_conditional_resize.rb
Last active Dec 17, 2015
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.
View paperclip_conditional_resize.rb
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
View dabblet.css
body {margin: 0; padding: 10px;}​
You can’t perform that action at this time.