Skip to content

Instantly share code, notes, and snippets.

View yckart's full-sized avatar

Yannick Albert yckart

View GitHub Profile
@lgarron
lgarron / copyToClipboard.html
Last active December 20, 2023 12:53
Simple `navigator.clipboard.writeText()` polyfill.
<script>
// A minimal polyfill for copying text to clipboard that works most of the time in most capable browsers.
// Note that:
// - You may not need this. `navigator.clipboard.writeText()` works directly in all modern browsers as of 2020.
// - In Edge, this may call `resolve()` even if copying failed.
// - In Safari, this may fail if there is nothing selected on the page.
// See https://github.com/lgarron/clipboard-polyfill for a more robust solution.
//
// License for this Gist: public domain / Unlicense
function writeText(str) {
@chrisdiana
chrisdiana / gist:ac64daf20d405b33d7a6
Last active September 10, 2021 12:24
PHP Login without Database
<?php
session_start();
// ***************************************** //
// ********** DECLARE VARIABLES ********** //
// ***************************************** //
$username = 'username';
$password = 'password';
@cvengros
cvengros / gist:b2a7e82f66519d423b6f
Created November 15, 2014 01:30
Download directory from GitHub through API
class GitHub
class << self
def download_file_to_string(github_token, setup={}, raw=true, link=nil)
if link
url = link
else
sql_repo_name = setup['repo_name']
sql_repo_owner = setup['repo_owner']
# URI join won't make it:
@hamaluik
hamaluik / AABB.hx
Created October 6, 2014 05:38
Continuous collision detection between two moving AABBs using Minkowski differences.
package ;
import openfl.display.Sprite;
/**
* ...
* @author Kenton Hamaluik
*/
class AABB
{
public var center:Vector = new Vector();
@Bolloxim
Bolloxim / Asteriod-Field.markdown
Created August 3, 2014 06:25
A Pen by Andi Smithers.

Asteriod Field

Taking the icosahedron we deform the vertices randomly for each asteriod giving a unique shape to each one. We then give it some rotational component and then collide them with each other to create a nice bouncing action.

version 0.2 allow morphing greater a safe value which now can cause concave issues.

version 0.3 timer to spawn a new random field. Tied into the same structures as the long range scanner.

A Pen by Andi Smithers on CodePen.

@pascalduez
pascalduez / SassMeister-input.scss
Last active September 22, 2022 08:05
Deep nested values in Sass maps
// ----
// Sass (v3.3.7)
// Compass (v1.0.0.alpha.18)
// ----
// Deep nested values in Sass maps.
// Fetch a deep value in a multi-level map.
// https://gist.github.com/KittyGiraudel/9933331
@pascalduez
pascalduez / SassMeister-input.scss
Created April 30, 2014 19:16
Prototypal inheritance in Sass
// ----
// Sass (v3.3.7)
// Compass (v1.0.0.alpha.18)
// ----
// Prototypal inheritance in Sass
// Disclaimer: might be totally contrived and useless...
// “It’s not about the destination, but the journey.”
// New operator
@ryansechrest
ryansechrest / bash-commands.sh
Last active April 20, 2020 18:15
New and enhanced bash commands for developers on Mac OS X.
#!/bin/bash
# ---------------------------------------------------------------------------
#
# File: .bash_commands
#
# Author: Ryan Sechrest
# Website: ryansechrest.com
#
# Description: New and enhanced bash commands for developers on Mac OS X.
@obenjiro
obenjiro / vertical-text.css
Last active April 4, 2020 20:23
CrossBrowser Vertical CSS Text
/**
* Works everywere ( IE7+, FF, Chrome, Safari, Opera )
* Example: http://jsbin.com/afAQAWA/2/
*/
.rotated-text {
display: inline-block;
overflow: hidden;
width: 1.5em;
}
.rotated-text__inner {
@wintercn
wintercn / template.html
Created September 29, 2013 14:52
一个简单的dom型模板示例
<div>
<a href="{{protocol}}//{{host}}{{pathname}}">{{protocol}}//{{host}}{{pathname}}</a>
</div>
<script>
function Template(node) {
var prototype = document.createDocumentFragment();
prototype.appendChild(node);