Skip to content

Instantly share code, notes, and snippets.

View nwaughachukwuma's full-sized avatar
🧶
Making stuff

Chukwuma Nwaugha nwaughachukwuma

🧶
Making stuff
View GitHub Profile
/*
Copyright 2011 Martin Hawksey
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@nwaughachukwuma
nwaughachukwuma / embedded-file-viewer.md
Created June 2, 2018 05:12 — forked from tzmartin/embedded-file-viewer.md
Embedded File Viewer: Google Drive, OneDrive

Office Web Apps Viewer

('.ppt' '.pptx' '.doc', '.docx', '.xls', '.xlsx')

http://view.officeapps.live.com/op/view.aspx?src=[OFFICE_FILE_URL]

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=[OFFICE_FILE_URL]' width='px' height='px' frameborder='0'>
</iframe>

OneDrive Embed Links

@nwaughachukwuma
nwaughachukwuma / gist:01169ded3507ba7a60b29cd1920d7482
Created February 18, 2019 09:44 — forked from achavez/gist:9767499
Post to Slack using javascript
var url = // Webhook URL
var text = // Text to post
$.ajax({
data: 'payload=' + JSON.stringify({
"text": text
}),
dataType: 'json',
processData: false,
type: 'POST',
url: url
@nwaughachukwuma
nwaughachukwuma / User.php
Last active March 28, 2020 21:41
A user model with it's relationships
<?
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
public function photos()
{
return $this->hasMany('\App\Photo');
}
public function posts()
{
@nwaughachukwuma
nwaughachukwuma / Post.php
Last active March 28, 2020 21:45
A post model with it's relationships
<?
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
public function user()
{
return $this->belongsTo('\App\User');
}
public function comments()
@nwaughachukwuma
nwaughachukwuma / Photo.php
Last active March 28, 2020 21:44
A photo model with it's relationships
<?
use Illuminate\Database\Eloquent\Model;
class Photo extends Model
{
public function user()
{
return $this->belongsTo('\App\User');
}
}
@nwaughachukwuma
nwaughachukwuma / Comment.php
Last active March 28, 2020 21:46
A comment model with it's relationship
<?
use Illuminate\Database\Eloquent\Model;
class Comment extends Model
{
public function post()
{
return $this->belongsTo('\App\Post');
}
}
function groupByGender(users = []) {
let genderGroup = {
male: [],
female: []
}
users.map(el => {
if (parseInt(el.age) >= 30 && parseInt(el.age) <= 40) {
if (el.gender.toLowerCase() === 'male') {
genderGroup.male.push(el)
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:host="eventsmag.page.link" android:scheme="http"/>
<data android:host="eventsmag.page.link" android:scheme="https"/>
</intent-filter>