Skip to content

Instantly share code, notes, and snippets.

// Converting Twitter Bootstrap RFS mechanism into typescript to make it available for CSS in JS i.e. (styled components).
// Twitter Bootstrap RFS: https://github.com/twbs/rfs
// Javascript Approach: https://gist.github.com/supposedly/9b9f5de66c2bcbbf5d7469dcec50bfd7
// Usage
// import rfs from 'rfs';
// rfs( '20px', 'font-size' );
// rfs( '1.5rem', 'font-size' );
// rfs( '1rem', 'margin-bottom' );
@supposedly
supposedly / rfs.js
Last active February 27, 2024 23:34
Good-enough translation of RFS into JS (for use with styled-components) -- see usage.md for usage info
/*
SCSS RFS mixin - converted unofficially to JS
Please note that the author(s) and maintainer(s) of RFS aren't responsible for this port. Direct issues to @supposedly
********
Automated responsive values for font sizes, paddings, margins and much more
Licensed under MIT (https://github.com/twbs/rfs/blob/master/LICENSE):
/**
* Wrapper for Http Request.
* Uses fetch API.
* Mocks are using the following convention : '/pathx/pathy' is fetching ./mock_api/pathx.pathy.js
* pathx.pathy.js is a javascript file exporting a default element : export default { prop: 'value' } or export default [{ prop: 'value' }]
*
* --- Usage with mocks
* ----- json under ./mock_api/i18n.EN.js
* > const langProps = await http.get<LocaleMessageDictionary<VueMessageType>>(`/i18n/${locale.code}`, undefined, true)
*
@derrabus
derrabus / dump_routes.php
Created December 20, 2017 16:30
Extract Symfony routing configuration from a Silex application
#!/usr/bin/env php
<?php
use Silex\Application;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCompiler;
use Symfony\Component\Yaml\Yaml;
require_once __DIR__ . '/vendor/autoload.php';
@noelbundick
noelbundick / LICENSE
Last active October 5, 2023 04:20
Solarized Dark for Bash on Windows
MIT License
Copyright (c) 2018 Noel Bundick
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@dahjelle
dahjelle / pre-commit.sh
Created July 13, 2016 16:48
Pre-commit hook for eslint, linting *only* staged changes.
#!/bin/bash
for file in $(git diff --cached --name-only | grep -E '\.(js|jsx)$')
do
git show ":$file" | node_modules/.bin/eslint --stdin --stdin-filename "$file" # we only want to lint the staged changes, not any un-staged changes
if [ $? -ne 0 ]; then
echo "ESLint failed on staged file '$file'. Please check your code and try again. You can run ESLint manually via npm run eslint."
exit 1 # exit with failure status
fi
done
$countryCodes = array(
array (
'country_code' => 'AF',
'phone_code' => '93',
),
array (
'country_code' => 'AX',
'phone_code' => '35818',
),
array (
@manuhabitela
manuhabitela / create-drawing.php
Last active November 26, 2020 11:08
DrawingBoard: let people draw and save their images server-side https://github.com/Leimi/drawingboard.js
<?php
//server-side code where we save the given drawing in a PNG file
$img = filter_input(INPUT_POST, 'image', FILTER_SANITIZE_URL);
$name = filter_input(INPUT_POST, 'name', FILTER_SANITIZE_STRING);
//see http://j-query.blogspot.fr/2011/02/save-base64-encoded-canvas-image-to-png.html
$img = str_replace(' ', '+', str_replace('data:image/png;base64,', '', $img));
$data = base64_decode($img);
@naholyr
naholyr / _service.md
Created December 13, 2012 09:39
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)