Skip to content

Instantly share code, notes, and snippets.

View znsstudio's full-sized avatar

Samir Yahyazade znsstudio

View GitHub Profile
@znsstudio
znsstudio / index.html
Created October 13, 2021 18:40 — forked from gaearon/index.html
Add React in One Minute
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Add React in One Minute</title>
</head>
<body>
<h2>Add React in One Minute</h2>
<p>This page demonstrates using React with no build tooling.</p>
<script type="text/javascript">
function setCookie(cname,cvalue,exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
var expires = "expires=" + d.toGMTString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/;SameSite=None; Secure";
}
function getCookie(cname) {
@znsstudio
znsstudio / MySQL_5-7_macOS.md
Created May 22, 2019 13:05 — forked from robhrt7/MySQL_5-7_macOS.md
Install MySQL 5.7 on macOS using Homebrew

This is a fork of original gist https://gist.github.com/nrollr/3f57fc15ded7dddddcc4e82fe137b58e, with slight changes on pointing to 5.7 version branch, instead of 8 (latest default of MySQL in Hombrew).

Install MySQL 5.7 on macOS

This procedure explains how to install MySQL using Homebrew on macOS (Sierra 10.12 and up)

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.
## gov.uk auditd rules, amended for hmrc
## Remove any existing rules
-D
## Buffer Size
## Feel free to increase this if the machine panic's
-b 8192
## Failure Mode
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>Subscriptions - freek@spatie.be</title>
</head>
<body>
<outline text="PHP" title="PHP">
<outline htmlUrl="http://mattallan.org" title="mattallan.org" xmlUrl="http://mattallan.org/feed.xml" type="rss" text="mattallan.org"/>
<outline title="asked.io" xmlUrl="https://asked.io/rss" type="rss" text="asked.io"/>
<outline htmlUrl="https://ocramius.github.io/" title="ocramius.github.io" xmlUrl="https://ocramius.github.io/atom.xml" type="rss" text="ocramius.github.io"/>
@znsstudio
znsstudio / nginx_docker_redirect.conf
Created February 8, 2017 15:05 — forked from technolo-g/nginx_docker_redirect.conf
Redirect subdomain to port (nginx)
# This will redirect a numerical subdomain to a port.
# A use would be Docker contianers.
# This relies on the following DNS record:
# *.test.domain.com IN A 10.100.199.31
# and the fact that this container would run on the same Docker
# host as the backends.
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
@znsstudio
znsstudio / gist:0993b26e203789bfa57a02219fa30eca
Created April 1, 2016 20:02 — forked from srobbin/gist:1978678
Backstretch Demo: Slideshow
/*
* Here is an example of how to use Backstretch as a slideshow.
* Just pass in an array of images, and optionally a duration and fade value.
*/
// Duration is the amount of time in between slides,
// and fade is value that determines how quickly the next image will fade in
$.backstretch([
"http://dl.dropbox.com/u/515046/www/outside.jpg"
, "http://dl.dropbox.com/u/515046/www/garfield-interior.jpg"
@znsstudio
znsstudio / global.php
Created March 31, 2016 16:19
Gist for simple database logging in Laravel 4, instead of plain text files. You will then be able to get logs from your DB like this : `SELECT * FROM logs;`
<?php
// app/start/global.php
/*
|--------------------------------------------------------------------------
| Application Error Logger
|--------------------------------------------------------------------------
|
| Here we will configure the error logger setup for the application which
/* Set up Git Configuration */
git config --global user.email "you@yourdomain.com"
git config --global user.name "Your Name"
git config --global core.editor "vi"
git config --global color.ui true
@znsstudio
znsstudio / gist:fb71458d0e3dd0ebc3e0
Created October 8, 2015 03:22 — forked from jonathanmoore/gist:2640302
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter