Skip to content

Instantly share code, notes, and snippets.

Avatar

Yannick Albert yckart

View GitHub Profile
@lgarron
lgarron / copyToClipboard.html
Last active Oct 9, 2021
Simple `navigator.clipboard.writeText()` polyfill.
View copyToClipboard.html
<script>
// A minimal polyfill fof 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 Sep 10, 2021
PHP Login without Database
View gist:ac64daf20d405b33d7a6
<?php
session_start();
// ***************************************** //
// ********** DECLARE VARIABLES ********** //
// ***************************************** //
$username = 'username';
$password = 'password';
@cvengros
cvengros / gist:b2a7e82f66519d423b6f
Created Nov 15, 2014
Download directory from GitHub through API
View gist:b2a7e82f66519d423b6f
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 Oct 6, 2014
Continuous collision detection between two moving AABBs using Minkowski differences.
View AABB.hx
package ;
import openfl.display.Sprite;
/**
* ...
* @author Kenton Hamaluik
*/
class AABB
{
public var center:Vector = new Vector();
View Asteriod-Field.markdown

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 Jul 25, 2021
Deep nested values in Sass maps
View SassMeister-input.scss
// ----
// 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 Apr 30, 2014
Prototypal inheritance in Sass
View SassMeister-input.scss
// ----
// 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 Apr 20, 2020
New and enhanced bash commands for developers on Mac OS X.
View bash-commands.sh
#!/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 Apr 4, 2020
CrossBrowser Vertical CSS Text
View vertical-text.css
/**
* 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 Sep 29, 2013
一个简单的dom型模板示例
View template.html
<div>
<a href="{{protocol}}//{{host}}{{pathname}}">{{protocol}}//{{host}}{{pathname}}</a>
</div>
<script>
function Template(node) {
var prototype = document.createDocumentFragment();
prototype.appendChild(node);