Skip to content

Instantly share code, notes, and snippets.

nhahaag

Block or report user

Report or block nhahaag

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mikowl
mikowl / oneliners.js
Last active Dec 2, 2019
👑 Awesome one-liners you might find useful while coding.
View oneliners.js
// By @coderitual
// https://twitter.com/coderitual/status/1112297299307384833
// Remove any duplicates from an array of primitives.
const unique = [...new Set(arr)]
// Sleep in async functions. Use: await sleep(2000).
const sleep = (ms) => (new Promise(resolve => setTimeout(resolve, ms)));
// Type this in your code to break chrome debugger in that line.
@iwazaru
iwazaru / smooth-scroll.js
Created Sep 6, 2017
Simple smooth-scroll animation in pure/vanilla javascript
View smooth-scroll.js
/**
* Smooth scroll animation
* @param {int} endX: destination x coordinate
* @param {int) endY: destination y coordinate
* @param {int} duration: animation duration in ms
*/
window.smoothScrollTo = function(endX, endY, duration) {
var startX = window.scrollX || window.pageXOffset,
startY = window.scrollY || window.pageYOffset,
distanceX = endX - startX,
@m1r0
m1r0 / wp_insert_attachment_from_url.php
Last active Nov 30, 2019
WP: Insert attachment from URL
View wp_insert_attachment_from_url.php
<?php
/**
* Insert an attachment from an URL address.
*
* @param String $url
* @param Int $parent_post_id
* @return Int Attachment ID
*/
function crb_insert_attachment_from_url($url, $parent_post_id = null) {
@joyrexus
joyrexus / README.md
Last active Dec 6, 2019 — forked from liamcurry/gist:2597326
Vanilla JS equivalents of jQuery methods
View README.md

Sans jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@bjoernQ
bjoernQ / AndroidManifest.xml
Created Oct 14, 2013
Creating a System Overlay (Always on Top over all Apps) in Android
View AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.mobilej.overlay"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="14" />
<application android:label="SystemOverlay" >
<activity
View gist:3698476
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php
*/
$args = array(
You can’t perform that action at this time.