methods: {
hasCameraCapability() {
return !!(window.navigator.mediaDevices && window.navigator.getUserMedia)
},
requestCameraAccess(config = {video: true}) {
return window.navigator.getUserMedia(config)
},
View Camera.md
View M-PesaAPIAccess.md
Access Safaricom's M-Pesa API
This gist describes the processes of allowing us to access the Safaricom's M-Pesa API. At the end of the process
we will obtain all variable needed to start using their API. We will be using the Customer to Business (C2B) API.
This gist has been created as an Appendix to this article (part 1).
Start the Engine
View mp-1-g2.md
$teams = App\Team::with([
'portfolios' => function ($query) use ($user) {
// Only include portfolios where...
$query->whereHas('wallets', function ($query) use ($user) {
// ...there are wallets...
$query->whereHas('transactions', function ($query) {
// ...with pending transactions...
$query->whereStatus('pending');
});
View mp-1-g3.md
$teams = App\Team::whereHas('portfolios', function ($query) use ($user) {
// Only include teams with portfolios where...
$query->whereHas('wallets', function ($query) use ($user) {
// ...there are wallets...
$query->whereHas('transactions', function ($query) {
// ...with pending transactions...
$query->whereStatus('pending');
});
View encrypted_unique
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Validator::extend('encrypted_unique', function ($attribute, $value, $parameters, $validator) { | |
list ($table, $column, $ignore_id) = $parameters; // or hard-coded if fixed | |
$count = $validator->getPresenceVerifier()->getCount($table, $column, encrypt($value), $ignore_id); | |
return $count === 0; | |
}); | |
'identifier' => "encrypted_unique:table,column,$this_id" |
View mail
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$transport = new Swift_SmtpTransport('SMTP-HOST-HERE', SMTP-PORT-HERE); | |
$transport->setUsername('SMTP-USERNAME-HERE'); | |
$transport->setPassword('SMTP-PASSWORD-HERE'); | |
// extra configurations here if needed | |
Then, we use the Swift_SmtpTransport to build our Swift_Mailer object. | |
$swift_mailer = new Swift_Mailer($transport); |
View html2canvas.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html2canvas($("#canvas"), { | |
onrendered: function(canvas) { | |
var imgData = canvas.toDataURL( | |
'image/png'); | |
var doc = new jsPDF('p', 'mm'); | |
doc.addImage(imgData, 'PNG', 10, 10); | |
doc.save('sample-file.pdf'); | |
} | |
}); |
View starts_with helper.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (starts_with($uploadedFile->getClientMimeType(), 'image')) { | |
} |
View gist:3e17b84959088c835539d3f6a4ef893f
Branching
Description, Instructions, Notes Quick Legend
Instance | Branch |
---|