Skip to content

Instantly share code, notes, and snippets.

View tojibon's full-sized avatar
:octocat:
Finalizing

Juyal Ahmed tojibon

:octocat:
Finalizing
View GitHub Profile
@rjmacarthy
rjmacarthy / Client.js
Last active October 13, 2015 05:26
Sails.js Socket.io Configuration
socket = io.connect();
socket.on('connect', function socketConnected() {
socket.on('sockets', function newMessageFromSails ( data ) {
console.log(data); // Data from socket
});
});
@mikermcneil
mikermcneil / query-multiple-models-in-sails-controller-action.js
Created September 16, 2015 19:05
Querying multiple models from a controller action in Sails
//...
showSchoolDetailPage: function (req, res) {
if (!req.param('id')) {
return res.badRequest('The id of the school (`id`) is a required parameter!');
}
// Look up the school, it's associated image, and the associated list of students.
School.findOne({
id: req.param('id')
@mikermcneil
mikermcneil / associations-proposal.js
Last active April 16, 2016 17:32
another proposal for instance methods and associations
// Note that instance and class methods could also be defined at the adapter level
// (e.g. CRUD adapters add .save() and .destroy() methods, but the Twillio API might add a .call() method)
// User.js
module.exports = sails.Model.extend({
// Adapters are applied from left to right
// (methods defined in more than one adapter use the rightmost adapter's version, just like _.extend)
adapter: ['mysql', 'twilio'],
@tojibon
tojibon / custom.js
Created September 2, 2015 03:49
Custom module for you to write your own javascript functions
/**
Custom module for you to write your own javascript functions
**/
var Custom = function () {
// private functions & variables
var myFunc = function(text) {
alert(text);
}
@tojibon
tojibon / install.md
Created March 14, 2017 08:05
Upgrade Node.js via NPM
sudo npm cache clean -f   
sudo npm install -g n   
sudo n stable   
sudo n 0.8.21   
node -v   
@hasinhayder
hasinhayder / envato-screenshots-downloader.php
Last active November 14, 2017 18:37
Download large preview images from the envato item's screenshots page
#!/usr/bin/env php
<?php
//usage: php envato-screenshots-downloader.php /path/to/save/screenshots http://url/to/screenshots/page
set_time_limit(0);
$dir = $argv[1];
$source = $argv[2];
print_r($argv);
mkdir ($dir);
$src = file_get_contents($source);
$pattern = '/src="(https:\/\/0.s3[a-zA-Z0-9_\-\.\/%]+)"/i';
@tojibon
tojibon / ControllerTrait.php.md
Last active November 14, 2017 20:18
CakePHP 3.5.x vs Croogo 3.0.x Can't activate Croogo/Core theme fix

Find Line Around - 51:

if (is_callable($callable)) {
    return call_user_func_array($callable, $request->params['pass']);
}

Replace:

if (is_callable($callable) && $request->params['action'] === 'activate' && is_array($request->params['pass'])) {
 return call_user_func_array($callable, [join('/', $request-&gt;params['pass'])]);
#!/bin/bash
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
apt-add-repository 'deb https://apt.dockerproject.org/repo ubuntu-xenial main'
apt-get update
apt-get install -y docker-engine
systemctl enable docker
usermod -aG docker ubuntu
curl -o /usr/local/bin/docker-compose -L "https://github.com/docker/compose/releases/download/1.11.2/docker-compose-$(uname -s)-$(uname -m)"
chmod +x /usr/local/bin/docker-compose
docker-compose -v
@tojibon
tojibon / readme.md
Created September 27, 2017 16:32
WordPress ubuntu plugin Installation failed: Could not create directory.

Open terminal and move to your WordPress root and execute below commands:

sudo chown -R www-data:www-data ./
sudo find ./ -type d -exec chmod 755  {} \;
sudo find ./ -type f -exec chmod 644  {} \;
@dynamicguy
dynamicguy / google.html
Created September 11, 2017 20:16
google home
<!doctype html>
<html itemscope="" itemtype="http://schema.org/WebPage" lang="en">
<head>
<meta content="IE=edge" http-equiv="X-UA-Compatible">
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<meta content="Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for."
name="description">
<meta content="noodp" name="robots">
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<meta content="/images/branding/googleg/1x/googleg_standard_color_128dp.png" itemprop="image">