Skip to content

Instantly share code, notes, and snippets.

Kylie Rose thisiskylierose

  • Australia
Block or report user

Report or block thisiskylierose

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
@jacob-beltran
jacob-beltran / requestAnimationFrame.js
Last active Oct 1, 2019
React Performance: requestAnimationFrame Example
View requestAnimationFrame.js
// How to ensure that our animation loop ends on component unount
componentDidMount() {
this.startLoop();
}
componentWillUnmount() {
this.stopLoop();
}
@maxogden
maxogden / 0.md
Last active Feb 17, 2020
JS hoisting by example
View 0.md

JavaScript function hoisting by example

Below are many examples of function hoisting behavior in JavaScript. Ones marked as works successfuly print 'hi!' without errors.

To play around with these examples (recommended) clone them with git and execute them with e.g. node a.js

Notes on hoisting

(I may be using incorrect terms below, please forgive me)

@hdragomir
hdragomir / sm-annotated.html
Last active Feb 4, 2020
The deferred font loading logic for Smashing Magazine. http://www.smashingmagazine.com/
View sm-annotated.html
<script type="text/javascript">
(function () {
"use strict";
// once cached, the css file is stored on the client forever unless
// the URL below is changed. Any change will invalidate the cache
var css_href = './index_files/web-fonts.css';
// a simple event handler wrapper
function on(el, ev, callback) {
if (el.addEventListener) {
el.addEventListener(ev, callback, false);
@stefansundin
stefansundin / install-pre-commit.sh
Last active Feb 5, 2020
Git pre-commit check to stop accidental commits to master and develop branches. There is also a variant with a core.whitespace check.
View install-pre-commit.sh
#!/bin/sh
# This gist contains pre-commit hooks to prevent you from commiting bad code or to the wrong branch.
# There are four variants that I have built:
# - pre-commit: stops commits to "master" and "develop" branches.
# - pre-commit-2: also includes a core.whitespace check.
# - pre-commit-3: the core.whitespace check and an EOF-newline-check.
# - pre-commit-4: only the core.whitespace check.
# - pre-commit-5: elixir formatting check.
# - pre-commit-6: prettier formatting check.
# Set desired version like this before installing:
View React
App.Features.instagram = (function(ig){
ig.init = function() {
if ( !$('#instagram').length ) return false;
var Instagram = React.createClass({displayName: 'Instagram',
loadApi: function() {
$.ajax({
url: this.props.url,
@joaocunha
joaocunha / modernizr-retina-test.js
Created Nov 27, 2013
Modernizr test for retina / high resolution / high pixel density.
View modernizr-retina-test.js
/**
* Modernizr test for retina / high resolution / high pixel density
*
* @author Joao Cunha
* @license MIT
*/
Modernizr.addTest('hires', function() {
// starts with default value for modern browsers
var dpr = window.devicePixelRatio ||
@stugoo
stugoo / modernizr-ios6-test.js
Created Nov 21, 2013
IOS 6 modernizer test, needed this for super edge case on iPad on landscape. :/
View modernizr-ios6-test.js
// i know, i know, browser sniffing :(
// adaptation of http://stackoverflow.com/questions/8348139/detect-ios-version-less-than-5-with-javascript
Modernizr.addTest('ios6', function() {
var ios6 = false,
v, ver = false;
if (/iP(hone|od|ad)/.test(navigator.platform)) {
v = (navigator.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/),
ver = parseInt(v[1], 10);
@PierreMage
PierreMage / PowerShell-profile.ps1
Last active Jan 14, 2020
Make your Windows command line better with doskey
View PowerShell-profile.ps1
# http://technet.microsoft.com/en-us/library/ee692685.aspx
# F7 = history
# Alt+F7 = history -c
# F8 = Ctrl+R
Set-Location C:
# Easier navigation
Set-Alias o start
function oo {start .}
@shawndumas
shawndumas / .gitconfig
Created Aug 5, 2013
Using WinMerge as the git Diff/Merge Tool on Windows 64bit
View .gitconfig
[mergetool]
prompt = false
keepBackup = false
keepTemporaries = false
[merge]
tool = winmerge
[mergetool "winmerge"]
name = WinMerge
@MoOx
MoOx / background.scss
Created Dec 12, 2012
Is there a sort of ternary operator in #Sass ?
View background.scss
//...
$background: null; // if you don't do this, background is undefined out of the @if/else scope
@if ($direction) {
$background: linear-gradient($direction, $color, $color2);
}
@else {
$background: linear-gradient($color, $color2);
}
//...
You can’t perform that action at this time.