Skip to content

Instantly share code, notes, and snippets.

View EDDYMENS's full-sized avatar
🏕️

Edmond Mensah EDDYMENS

🏕️
View GitHub Profile
@EDDYMENS
EDDYMENS / notify.html
Last active October 31, 2016 10:55
Cool easy way to add pop up flash notification to web frontend with nothing more than bootstrap.
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="modal fade" id="notif" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog" style="width:250px;height:3%;">
<div class="modal-content" style="background-color:#7BE454;">
<div class="modal-body">
<div id="left">
<div>
/**
* Sample React Native Modal Dialog Example App
*
* @see - https://github.com/facebook/react-native
* @see - https://github.com/Kureev/react-native-navbar
*/
'use strict';
var React = require('react-native');
var {
@johnotu
johnotu / addressbook.html
Created January 2, 2017 11:18
A Simple Addressbook using a DevLess Backend
<!DOCTYPE html>
<html>
<head>
<title>Address Book</title>
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<style type="text/css">
button{margin: 0 20px;}
</style>
</head>
<body>
@juliaelman
juliaelman / gist:a4720a95e8e78e651800
Created September 12, 2014 17:13
Tech Volunteer Opportunities
code.org
Non-profit dedicated to making computer science courses available in more classrooms increasing participation of women and underrepresented students of color
citizenschools.org
Partners with public middle schools in low income communities dedicated to helping all children discover and achieve their dreams.
girldevelopit.com
Exists to provide affordable and accessible programs to women who want to learn software development through mentorship and hands-on instruction.
codemontage.com
[...document.querySelectorAll('.invite-card')].forEach((card) => {
const acceptBtn = card.querySelector('.bt-invite-accept');
acceptBtn.click();
});
@EDDYMENS
EDDYMENS / pusher.php
Last active April 24, 2019 16:50
Single file (pusher.com) PHP SDK
<?php
function push(string $region, string $app_id, string $app_key, string $app_secret, string $channel, string $event, string $data) {
$postData = json_encode(['data'=>$data, 'name'=>$event, 'channel'=>$channel]);
$md5_string = md5($postData);
$timestamp = strtotime('now +5 minutes');
$auth_signature = hash_hmac('sha256', "POST\n/apps/$app_id/events\nauth_key=$app_key&auth_timestamp=$timestamp&auth_version=1.0&body_md5=$md5_string", $app_secret);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "http://api-$region.pusher.com/apps/$app_id/events?body_md5=$md5_string&auth_version=1.0&auth_key=$app_key&auth_timestamp=$timestamp&auth_signature=$auth_signature&",
CURLOPT_RETURNTRANSFER => true,
@robbens
robbens / default.blade.php
Created January 7, 2017 14:56
Bulma.io pagination for Laravel
@if ($paginator->hasPages())
<nav class="pagination is-centered">
@if ($paginator->onFirstPage())
<span class="pagination-previous is-disabled">Previous</span>
@else
<a class="pagination-previous" href="{{ $paginator->previousPageUrl() }}" rel="prev">Previous</a>
@endif
{{-- Next Page Link --}}
@if ($paginator->hasMorePages())
@ScottCooper92
ScottCooper92 / gist:ea11b690ba4b1278e049
Created May 4, 2015 22:17
Example of the various YouTube url formats
http://www.youtube.com/watch?v=-wtIMTCHWuI
http://www.youtube.com/v/-wtIMTCHWuI?version=3&autohide=1
http://youtu.be/-wtIMTCHWuI
http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D-wtIMTCHWuI&format=json
http://s.ytimg.com/yt/favicon-wtIMTCHWuI.ico
@derak-kilgo
derak-kilgo / mp4-to-gif.php
Created August 17, 2016 18:30
Convert a mp4 clip into a gif with php, imagemagick and ffmpeg. From OSX, these are easy to install with homebrew.
<?php
$video = __DIR__ . '/video.mp4';
$fps = 4;
# Convert an MP4 to a GIF - Requires ffmpeg
`ffmpeg -i "$video" -pix_fmt rgb24 -r $fps "$video.gif"`
# optimize the gif - Requires imagemagick
# via http://superuser.com/questions/436056/how-can-i-get-ffmpeg-to-convert-a-mov-to-a-gif
@jrmadsen67
jrmadsen67 / gist:bd0f9ad0ef1ed6bb594e
Last active February 15, 2022 08:41
Laravel Quick Tip: Handling CsrfToken Expiration gracefully
Quick tip for handling CSRF Token Expiration - common issue is when you use csrf protection is that if
a form sits there for a while (like a login form, but any the same) the csrf token in the form will
expire & throw a strange error.
Handling it is simple, and is a good lesson for dealing with other types of errors in a custom manner.
In Middleware you will see a file VerifyCsrfToken.php and be tempted to handle things there. DON'T!
Instead, look at your app/Exceptions/Handler.php, at the render($request, Exception $e) function.
All of your exceptions go through here, unless you have excluded them in the $dontReport array at the