Skip to content

Instantly share code, notes, and snippets.

View thinkingmedia's full-sized avatar

cgTag thinkingmedia

View GitHub Profile
@nickpiesco
nickpiesco / README.md
Last active March 21, 2017 22:23
Making Sass Linear Gradient Mixins Behave in IE

I wrote this fairly straightforward cross-browser linear gradient mixin:

@mixin gradient($from-color, $to-color) {
	background-color: mix($from-color, $to-color); /* Fallback */
	background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from($from-color), to($to-color));
	background-image: -webkit-linear-gradient(top, $from-color, $to-color); 
	background-image:    -moz-linear-gradient(top, $from-color, $to-color);
	background-image:     -ms-linear-gradient(top, $from-color, $to-color);
	background-image: -o-linear-gradient(top, $from-color, $to-color);
@bcap
bcap / start-stop-daemon-template
Last active July 21, 2023 11:12
Template file for creating linux services out of executables using the start-stop-daemon
#!/bin/bash
### BEGIN INIT INFO
# Provides: <service name>
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: <service description>
### END INIT INFO
function termFreqMap(str) {
var words = str.split(' ');
var termFreq = {};
words.forEach(function(w) {
termFreq[w] = (termFreq[w] || 0) + 1;
});
return termFreq;
}
function addKeysToDict(map, dict) {
@glueckpress
glueckpress / px-rem-cheat-sheet.css
Created May 26, 2013 16:17
Cheat sheet for rem-calculations based upon 14px and 16px.
/*! = $rembase: 14px
--------------------------------------------------------------
* hmtl { font-size: 87.5%; }
* body { font-size: 14px; font-size: 1rem; line-height: 1; }
* 4px 0.28571429rem
* 8px 0.571428571rem
* 12px 0.857142857rem
* 13px 0.928571429rem
* 14px 1rem
* 16px 1.142857143rem
@liunian
liunian / gist:9338301
Last active April 26, 2024 03:30
Human Readable File Size with PHP
<?php
# http://jeffreysambells.com/2012/10/25/human-readable-filesize-php
function human_filesize($bytes, $decimals = 2) {
$size = array('B','kB','MB','GB','TB','PB','EB','ZB','YB');
$factor = floor((strlen($bytes) - 1) / 3);
return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$size[$factor];
}
echo human_filesize(filesize('example.zip'));
@tonyarnold
tonyarnold / import_all.rb
Created March 24, 2014 03:02
Really rough script to copy GitHub issues to GitLab, including scaffolding users with the correct name/username, but dummy emails. Prepare to be spammed by notifications. Current issues include comments not being associated with their proper owner, pull requests aren't properly transferred and wiki page imports have not been tested.
# Community contributed script to import from GitHub to GitLab
# It imports repositories, issues and the wiki's.
# This script is not maintained, please send merge requests to improve it, do not file bugs.
# The issue import might concatenate all comments of an issue into one, if so feel free to fix this.
require 'bundler/setup'
require 'octokit'
require 'optparse'
require 'git'
require 'gitlab'
@yashuarc
yashuarc / enable_cors_on_cakephp.php
Last active November 7, 2023 15:43
Enabling CORS on CakePHP
public function beforeFilter() {
parent::beforeFilter();
$this->response->header('Access-Control-Allow-Origin','*');
$this->response->header('Access-Control-Allow-Methods','*');
$this->response->header('Access-Control-Allow-Headers','X-Requested-With');
$this->response->header('Access-Control-Allow-Headers','Content-Type, x-xsrf-token');
$this->response->header('Access-Control-Max-Age','172800');
}
@shawnrice
shawnrice / skeleton-daemon.sh
Created April 19, 2014 07:22
A template to write a quick daemon as a bash script
#!/bin/sh
# This is a skeleton of a bash daemon. To use for yourself, just set the
# daemonName variable and then enter in the commands to run in the doCommands
# function. Modify the variables just below to fit your preference.
daemonName="DAEMON-NAME"
pidDir="."
pidFile="$pidDir/$daemonName.pid"
@mitchwongho
mitchwongho / Docker
Last active November 29, 2023 06:36
Docker 'run' command to start an interactive BaSH session
# Assuming an Ubuntu Docker image
$ docker run -it <image> /bin/bash
@kikito
kikito / tools.md
Last active March 19, 2018 21:39
Comparison of JS charting libraries for an Angular-based JS project

I got this list from wikipedia. Then I removed all the libraries that where not MIT, Apache or BSD and those with no sourcecode metrics (i.e. not on github, bitbucket, or trak). And then I added the columns I wanted.

Library Source Last Commit Last Closed Issue Stars Forks Ng-bindings Dependencies
ricksaw github 1 month ago 1 month ago 4309 685 Yes D3.js
nvd3 github 2 days ago 1 day ago 2433 814 Yes D3.js
Flot github 14 days ago 9 days ago 3349 842 Yes 1, [2](https://git