Skip to content

Instantly share code, notes, and snippets.

Avatar
🤩
I am doing very fast fix 🚀, sponsor me 💖. https://github.com/sponsors/samsonasik

Abdul Malik Ikhsan samsonasik

🤩
I am doing very fast fix 🚀, sponsor me 💖. https://github.com/sponsors/samsonasik
View GitHub Profile
View EmojiLibrary.sql
DROP DATABASE IF EXISTS 📚;
CREATE DATABASE 📚;
USE 📚;
CREATE TABLE 👤(
🔑 INTEGER PRIMARY KEY,
🗣 varchar(64), -- name
🗓 DATE -- date of registration
@CyberPunkCodes
CyberPunkCodes / killadobe.sh
Last active Nov 21, 2022
Mac Bash script to kill Adobe Create Cloud and other processes that Adobe forces on us.
View killadobe.sh
#!/bin/bash
echo "\n\n--- Killing Stupid Adobe Auto Load Crap ---\n\n"
launchctl unload -w /Library/LaunchAgents/com.adobe.AdobeCreativeCloud.plist
launchctl unload -w /Library/LaunchAgents/com.adobe.AAM.Updater-1.0.plist
echo "\n\n--- Done! ---\n\n"
@hikari-no-yume
hikari-no-yume / example.php
Created Mar 20, 2017
function chaining for PHP 7
View example.php
<?php declare(strict_types=1);
require_once "✨.🐘";
✨($_)->strlen("foo")->var_dump($_);
@sergiodxa
sergiodxa / async-thread.js
Last active Sep 9, 2022
Use WebWorkers and promises to run sync heavy functions in a worker (process) and get the result in a promise
View async-thread.js
function asyncThread(fn, ...args) {
if (!window.Worker) throw Promise.reject(
new ReferenceError(`WebWorkers aren't available.`)
);
const fnWorker = `
self.onmessage = function(message) {
(${fn.toString()})
.apply(null, message.data)
.then(result => self.postMessage(result));
@settermjd
settermjd / download-file-in-expressive.php
Last active Jul 25, 2022
Quick example of how to download/stream a file using Zend Expressive.
View download-file-in-expressive.php
<?php
/**
* This is a quick example of how to stream a file to a client, likely a browser,
* using Zend Expressive. There are a lot of factors which it doesn't take in to
* account. But for the purposes of a quick intro, this should suffice.
*/
class ViewDocumentPageAction
{
protected function downloadFile()
{
@ferronrsmith
ferronrsmith / storagePolyfill.js
Created Aug 7, 2016 — forked from majuric/storagePolyfill.js
LocalStorage/SessionStorage Polyfill with Safari Private Browsing support.
View storagePolyfill.js
// Refer to:
// https://gist.github.com/remy/350433
// https://gist.github.com/jarrodirwin/0ce4c0888336b533b2c4
try {
// Test webstorage existence.
if (!window.localStorage || !window.sessionStorage) throw "exception";
// Test webstorage accessibility - Needed for Safari private browsing.
localStorage.setItem('storage_test', 1);
localStorage.removeItem('storage_test');
@kottenator
kottenator / simple-pagination.js
Created Jul 13, 2015
Simple pagination algorithm
View simple-pagination.js
// Implementation in ES6
function pagination(c, m) {
var current = c,
last = m,
delta = 2,
left = current - delta,
right = current + delta + 1,
range = [],
rangeWithDots = [],
l;
@jonathanstark
jonathanstark / verify-google-recaptcha-with-php
Last active Nov 17, 2022
Verify Google reCAPTCHA with PHP
View verify-google-recaptcha-with-php
#
# Verify captcha
$post_data = http_build_query(
array(
'secret' => CAPTCHA_SECRET,
'response' => $_POST['g-recaptcha-response'],
'remoteip' => $_SERVER['REMOTE_ADDR']
)
);
$opts = array('http' =>
@WebReflection
WebReflection / String.prototype.template.js
Last active Aug 17, 2022
ES6 Template like strings in ES3 compatible syntax.
View String.prototype.template.js
// this is now a module:
// https://github.com/WebReflection/backtick-template#es2015-backticks-for-es3-engines--
var template = require('backtick-template');
// just string
const info = 'template';
`some ${info}` === template('some ${info}', {info});
View controller.php
<?php
namespace Mockizart\Bundle\BlogBundle\Controller;
use Mockizart\Bundle\BlogBundle\MockizartBlogBundle;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Mockizart\Bundle\BlogBundle\Entity\MockblogTag;
use Mockizart\Bundle\BlogBundle\Form\MockblogTagType;