Skip to content

Instantly share code, notes, and snippets.

@tomasdev
tomasdev / how-to-patch-examples.sh
Last active January 21, 2020 12:10
Guide to patch - diff (How to use patch)
# Create a patch file
diff -u file.old file.new > file.patch
# Apply a patch
patch < file.patch
# Create a backup before applying patch
patch -b < file.patch
# Create a versioned backup before applying patch
@timhettler
timhettler / flex-grid.scss
Last active January 11, 2018 21:06
A configurable grid system using flexbox
$size--content: 1080px;
$size--column-gutter: 16px;
$size--columns: 8;
@function fluid-width($span) {
@return calc(#{percentage($span/$size--columns)} - #{$size--column-gutter});
}
.container {
margin: 0 $size--column-gutter * 2;
@inexorabletash
inexorabletash / @ Intl.Segmenter polyfill.md
Last active January 5, 2021 17:53
Intl.Segmenter polyfill

Following proposal by @littledan

THIS NO LONGER MATCHES THE PROPOSED API AND SHOULD NOT BE USED

Just proof-of-concept. Do not use in production.

Caveats:

@alekseykulikov
alekseykulikov / index.md
Last active April 14, 2024 00:32
Principles we use to write CSS for modern browsers

Recently CSS has got a lot of negativity. But I would like to defend it and show, that with good naming convention CSS works pretty well.

My 3 developers team has just developed React.js application with 7668 lines of CSS (and just 2 !important). During one year of development we had 0 issues with CSS. No refactoring typos, no style leaks, no performance problems, possibly, it is the most stable part of our application.

Here are main principles we use to write CSS for modern (IE11+) browsers:

@eliranmal
eliranmal / colors
Last active December 17, 2019 16:31 — forked from twerth/colors
List colors in shell
#!/usr/bin/env bash
echo -e "\033[0mNC (No color)"
echo -e "\033[1;37mWHITE\t\033[0;30mBLACK"
echo -e "\033[0;34mBLUE\t\033[1;34mLIGHT_BLUE"
echo -e "\033[0;32mGREEN\t\033[1;32mLIGHT_GREEN"
echo -e "\033[0;36mCYAN\t\033[1;36mLIGHT_CYAN"
echo -e "\033[0;31mRED\t\033[1;31mLIGHT_RED"
echo -e "\033[0;35mPURPLE\t\033[1;35mLIGHT_PURPLE"
echo -e "\033[0;33mYELLOW\t\033[1;33mLIGHT_YELLOW"
@tophtucker
tophtucker / README.md
Last active April 22, 2024 16:01
Beginning to reverse-engineer FizzyText

TOTALLY SUPER DUPER NOT MY WORK! Trying to illuminate how FizzyText (seen here, source here, isolated from dat.GUI dependency here) works. Original appears to have been written by George Michael Brower.

In the original, which I find brilliant:

  • Solid black text is drawn onto an invisible canvas, from which it gets bitmap data
  • The bitmap data is read like a collision detection array, where black means "you're on top of text" and white means "you're not"
  • Particles of size r=0 are randomly spawned on a visible canvas
  • The particles grow if they're on top of a (non-rendered) black pixel, and shrink till they disappear if not
  • When they shrink to r=0, they respawn randomly somewhere
  • The particles follow a Perlin noise flow field, a very sensible and fluid kind of random movement, in which nearby particles
@sonsongithub
sonsongithub / gist:ec1962ecd1530e3c2869
Created July 14, 2015 09:06
Simple movie view using AVKit
import UIKit
import AVFoundation
import AVKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
let item = AVPlayerItem(URL: NSURL(string: "http://i.imgur.com/4WHLcYw.mp4")!)
@getify
getify / nasty.js
Last active August 29, 2015 14:18 — forked from tomasdev/nasty.js
function segmentArray(arr,segmentSize) {
segmentSize = Math.max(1,Math.min(+segmentSize||0,arr.length));
return Array.apply(null,{length:Math.ceil(arr.length / segmentSize)}).map(function(_,i){
return arr.slice(i*segmentSize,(i+1)*segmentSize);
});
}
// lift `serviceCall(..)`
function promiseServiceCall(v) {
return new Promise(function(resolve,reject){
@mixin grid($cols: 1, $gutter: 0, $childs: ".item") {
width: auto;
margin-right: -$gutter;
#{$childs} {
float: left;
width: (100% / $cols);
padding-right: $gutter;
background-clip: content-box;
@ifnull
ifnull / fix-nike-plus.md
Last active May 8, 2018 19:11
How I fixed my Nike+ app.

You can't uninstall, you can't reset your profile and as long as your pin is valid on the Nike server it will continue to log your workouts to some diconnected account on their end. To fix this, you have to get your iPhone to invalidate your account.

  1. Install the trial version of Charles http://www.charlesproxy.com/download/

  2. Download the Charles certs and install them on your iPhone http://www.charlesproxy.com/ssl.zip

  3. Create a local map in Charles from https://nikeplus.nike.com/nikeplus/v1/services/device/get_pin_status.jsp to a local file with the following content.