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>
@EDDYMENS
EDDYMENS / string.rb
Last active October 24, 2017 13:37
Experimenting with DSLs in Ruby . This time trying to get closer to English as possible
String.new("edmond"). convert_to_upper_case. then. reverse_the_string. lastly. display_to_screen
class String
def initialize(string)
@@string = string
end
def convert_to_upper_case()
@@string = @@string.upcase()
<h1>What Yee seeks may be found in the console :) => </h1>
<script>
(function(l){function h(a,b,c,d,e){e=e||!1;var f=new XMLHttpRequest;f.addEventListener("readystatechange",function(){var a="";4===this.readyState&&0==e?200==this.status?(a=JSON.parse(this.responseText),d(a)):(d(a),console.error("Devless cannot be found at "+this.devless_instance_url+" Please copy the url from the `App tab` on you Devless instance by clicking on `connect to my app`")):4===this.readyState&&1==e&&(200==this.status?(a=this.responseText,d(a)):(d(a),console.error("Devless cannot be found at "+
this.devless_instance_url+" Please copy the url from the `App tab` on you Devless instance by clicking on `connect to my app`")))});f.open(c.toUpperCase(),this.devless_instance_url+b);f.setRequestHeader("content-type","application/json");f.setRequestHeader("devless-token",this.devless_token);""!=localStorage.getItem("devless_user_token"+this.devless_instance_url+this.devless_token)&&f.setRequestHeader("devless-user-token",localStorag
var App = {};
/**
@author Devless
@version 1
@description Devless sdk for Javascript
*/
/* Initizialize library */
(function (global /*this will contain the global window object*/) {
"use strict";
@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,
(Get-ChildItem -Recurse -Directory).FullName | ForEach-Object {fsutil.exe file setCaseSensitiveInfo $_ enable}
laravel broken error
<?php
namespace Illuminate\Contracts\Container {
use Closure;
interface Container
{
public function bound($abstract);
public function alias($abstract, $alias);
public function tag($abstracts, $tags);
public function tagged($tag);
public function bind($abstract, $concrete = null, $shared = false);
@EDDYMENS
EDDYMENS / CalculatestaticsCommand.php
Last active March 4, 2021 13:27
Stats Caching Method
public function handle() {
$cachedStats = collect([]);
try {
$year = $this->argument('year') ?? Carbon::now()->year;
Log::whereYear('ended_at_date', $year)->chunk(300, function($logList) use(&$cachedStats)
{
foreach ($logList as $log)
{
$params = json_decode($log->params);
$logDate = $log->ended_at_date;
class StatisticsController extends Controller {
public function dashboard(Request $request, $year) {
$year = $year ?? Carbon::now()->year;
if(!Cache::has('dashStatsCache-'.$year)) {
Artisan::call('logStats:run', [
'year' => $year,
]);
}
$stats = Cache::get('dashStatsCache-'.$year);
return view('dashboard')->with(compact('stats'));

Get a list of templates

This endpoint retrieves a list of available templates stored in eTrusted.

The result set can be filtered by adding request parameters.

  • URL

    /users/:id