Skip to content

Instantly share code, notes, and snippets.

View ncou's full-sized avatar
🪲
Catching bugs !

ncou

🪲
Catching bugs !
View GitHub Profile
@ncou
ncou / slack.php
Created April 16, 2018 06:25 — forked from stefanzweifel/slack.php
Slack.com Webhook Integration (PHP) - Simple snippet which tells you, how to build your payload array.
<?php
//Options
$token = 'YOUR_TOKEN_HERE';
$domain = 'YOUR_SLACK_DOMAIN_GOES_HERE';
$channel = '#general';
$bot_name = 'Webhook';
$icon = ':alien:';
$message = 'Your message';
@ncou
ncou / JWT
Last active October 14, 2017 13:44
JWT JSON auth
<?php
/**
* JSON Web Token implementation, based on this spec:
* http://tools.ietf.org/html/draft-ietf-oauth-json-web-token-06
*
* PHP version 5
*
* @category Authentication
* @package Authentication_JWT
* @author Neuman Vong <neuman@twilio.com>
@ncou
ncou / media-query.css
Created October 9, 2017 21:18 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
@ncou
ncou / Media Query CSS
Created October 9, 2017 21:17 — forked from dhamaso/Media Query CSS
Media Query CSS Template
/*=====================================================
Twitter Bootstrap
=====================================================*/
/* Large desktop */
@media (min-width: 1200px) { ... }
/* Portrait tablet to landscape and desktop */
@media (min-width: 768px) and (max-width: 979px) { ... }
/* Landscape phone to portrait tablet */
@ncou
ncou / color_luminance.php
Created September 7, 2017 21:18 — forked from stephenharris/color_luminance.php
Lighten or darken a given colour
<?php
/**
* Lightens/darkens a given colour (hex format), returning the altered colour in hex format.7
* @param str $hex Colour as hexadecimal (with or without hash);
* @percent float $percent Decimal ( 0.2 = lighten by 20%(), -0.4 = darken by 40%() )
* @return str Lightened/Darkend colour as hexadecimal (with hash);
*/
function color_luminance( $hex, $percent ) {
// validate hex string
@ncou
ncou / throttle
Created September 5, 2017 05:33 — forked from simmo/throttle.js
JavaScript Throttle using requestAnimationFrame
function throttle(type, name, obj) {
var running = false;
obj = obj || window;
var func = function() {
if (running) return;
running = true;
@ncou
ncou / draggable popup app.js
Created August 30, 2017 10:22 — forked from akirattii/app.js
Draggable & Movable popup example using pure javascript.
(function(){
var SCROLL_WIDTH = 24;
var btn_popup = document.getElementById("btn_popup");
var popup = document.getElementById("popup");
var popup_bar = document.getElementById("popup_bar");
var btn_close = document.getElementById("btn_close");
var smoke = document.getElementById("smoke");
@ncou
ncou / inherit
Created August 17, 2017 13:06 — forked from Moncader/gist:3521832
JS Class Style Inheriting
function inherit(pThis, pBase) {
pThis.prototype = Object.create(pBase.prototype);
pThis.prototype.constructor = pThis;
pThis.prototype.super = pBase.prototype;
}
function Animal() {
this.type = 'animal';
this.num = 34;
}
@ncou
ncou / inherit.js
Created August 17, 2017 13:03 — forked from iptpv/inherit.js
Yet another inherit library.
var extend = function(target, source) {
for (var i in source) {
if (source.hasOwnProperty(i)) {
target[i] = source[i];
}
}
return target;
};
var objectCreate = function(ParentProto, ChildProto) {
@ncou
ncou / jquery.debounce.js
Created August 8, 2017 21:31 — forked from evanre/debounce-throttle.js
Debounce and throttle function's decorator jQuery plugin
/**
* Debounce and throttle function's decorator plugin 1.0.5
*
* Copyright (c) 2009 Filatov Dmitry (alpha@zforms.ru)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
* https://habrahabr.ru/post/60957/
*
*/