Skip to content

Instantly share code, notes, and snippets.

View DeviaVir's full-sized avatar
🏴‍☠️

Chase DeviaVir

🏴‍☠️
View GitHub Profile
@LeaVerou
LeaVerou / vunits.js
Created November 8, 2011 11:05
Static polyfill for vw, vh, vm units
/**
* Polyfill for the vw, vh, vm units
* Requires StyleFix from -prefix-free http://leaverou.github.com/prefixfree/
* @author Lea Verou
*/
(function() {
if(!window.StyleFix) {
return;
@paulrouget
paulrouget / example.html
Created February 16, 2012 13:35
Fullscreen in a the context menu
<canvas contextmenu="fullscreenmenu"></canvas>
<!-- can be a div if you prefer -->
<menu id="fullscreenmenu" type="context">
<menuitem label="fullscreen"
onclick="document.querySelector('canvas').requestFullScreen()">
</menuitem>
</menu>
<script>
@DAddYE
DAddYE / hack.sh
Created March 19, 2012 11:31
OSX For Hackers
#!/bin/sh
##
# This is a script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# Run in interactive mode with:
# $ sh -c "$(curl -sL https://raw.github.com/gist/2108403/hack.sh)"
#
# or run it without prompt questions:
@DeviaVir
DeviaVir / dabblet.css
Created April 18, 2012 12:09 — forked from LeaVerou/dabblet.css
Vertical centering with Flexbox + margin fallback
/**
* Vertical centering with Flexbox + margin fallback
* Lea Verou & David Storey
*/
html, body { height: 100%; }
body {
width: 100%; /* needed for FF */
margin: 0;
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@DeviaVir
DeviaVir / index.html
Created August 16, 2012 18:24
A three dimensional and space efficient menu concept. Could easily be made CSS-only via :hover but touch is cool so I went for JavaScript.
<!-- Menu element that rolls in from the left -->
<div class="meny">
<h2>More Experiments</h2>
<ul>
<li><a href="http://lab.hakim.se/radar/">Radar</a></li>
<li><a href="http://lab.hakim.se/forkit-js/">forkit.js</a></li>
<li><a href="http://lab.hakim.se/scroll-effects/">stroll.js</a></li>
<li><a href="http://lab.hakim.se/zoom-js">zoom.js</a></li>
<li><a href="http://lab.hakim.se/reveal-js">reveal.js</a></li>
<li><a href="http://itunes.apple.com/us/app/sinuous/id543097218">Sinuous iOS</a></li>
@flores
flores / hastebin.sh
Created September 8, 2012 00:39
hastebin shell client
#!/bin/bash
server='hastebin.com';
usage="$0 pastes into $server
usage: $0 something
example: '$0 pie' or 'ps aufx |$0'"
if [ -z $1 ]; then
str=`cat /dev/stdin`;
@nikic
nikic / password_hashing_api.md
Created September 12, 2012 15:04
The new Secure Password Hashing API in PHP 5.5

The new Secure Password Hashing API in PHP 5.5

The [RFC for a new simple to use password hashing API][rfc] has just been accepted for PHP 5.5. As the RFC itself is rather technical and most of the sample codes are something you should not use, I want to give a very quick overview of the new API:

Why do we need a new API?

Everybody knows that you should be hashing their passwords using bcrypt, but still a surprising number of developers uses insecure md5 or sha1 hashes (just look at the recent password leaks). One of the reasons for this is that the crypt() API is ridiculously hard to use and very prone to programming mistakes.

@chriseppstein
chriseppstein / SassMeister-input.scss
Created November 13, 2013 16:01 — forked from kaelig/SassMeister-input.scss
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.1)
// Compass (v0.13.alpha.10)
// ----
// Transform a value into rem
// Assuming baseline is set to 10px on :root/html
@function rem($value, $baseline: 10px) {
@if type-of($value) == list {
$result: ();
@DeviaVir
DeviaVir / latlondistance.sql
Created December 5, 2013 15:20
Calculating distance between two points (Latitude, Longitude). Author: https://coderwall.com/st0ik
$lat = 41.118491 // Users latitude
$lng = 25.404509 // Users longitude
SELECT *,
( 6371 * acos( cos( radians($lat) )
* cos( radians( latitude ) )
* cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) )
* sin( radians( latitude ) ) ) )
AS calculated_distance
FROM settings as T