Skip to content

Instantly share code, notes, and snippets.

View shrwnsan's full-sized avatar
🏠
Working from home

shrwnsan

🏠
Working from home
View GitHub Profile
@shrwnsan
shrwnsan / sc-dl-min.js
Last active August 29, 2015 13:55 — forked from duncanbeevers/sc-dl-min.js
Bookmarklet which creates download links on *any* Soundcloud page. Full credit goes to @duncanbeevers, with contributions from @markpiro and @haroldSanchezb -- Last tested on Soundcloud site: 4 Feb 2013 Successful :-)
!function(a){var b,c,d,e=$(".sound"),f=require("config").get("client_id");require("lib/connect").getAuthToken();var i,j,k,l,m,h=require("lib/helpers/conversion-helper");for(b=e.length-1;b>=0;b--){c=$(e[b]);var n="https://soundcloud.com"+(c.find(".soundTitle__title").attr("href")||a.location.pathname);k={url:n,client_id:f},m=function(a){return function(b){var c={client_id:f};l=require("lib/url").stringify({query:c},b.stream_url+".mp3"),d=$(a.find(".sound__soundActions .sc-button-group")[0]),j=d.find(".sc-button:first")[0].className.match(/sc-button-((?:small)|(?:medium))/)[1],i=$('<a class="sc-button sc-button-download sc-button-icon sc-button-responsive">Download</a>').attr({title:"Download this sound ("+h.bytesToMB(b.original_content_size)+")",href:l,download:a.find(".soundTitle__title").first().text()+".mp3"}).addClass("sc-button-"+j),0==a.find(".sc-button-download").length&&d.append(i)}}(c),$.getJSON("http://api.soundcloud.com/resolve.json",k).success(m)}}(window);
@shrwnsan
shrwnsan / gulpfile-express.js
Last active August 29, 2015 13:56 — forked from mollerse/gulpfile-express.js
Gulpfile configs
var gulp = require('gulp'),
sass = require('gulp-sass'),
browserify = require('gulp-browserify'),
concat = require('gulp-concat'),
embedlr = require('gulp-embedlr'),
refresh = require('gulp-livereload'),
lrserver = require('tiny-lr')(),
express = require('express'),
livereload = require('connect-livereload')
livereloadport = 35729,
@shrwnsan
shrwnsan / .get-latest-stable-npm
Created September 3, 2014 14:54
Fix for Homebrew kicking users to beta version of npm. Source: https://github.com/npm/npm/issues/6051#issuecomment-53727415
npm install --globel npm@latest
@shrwnsan
shrwnsan / .htaccess
Created January 5, 2015 19:51
To remove the .php extension from a PHP file for example yoursite.com/wallpaper.php to yoursite.com/wallpaper
# Removing Extensions
# Source http://alexcican.com/post/how-to-remove-php-html-htm-extensions-with-htaccess/
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
@shrwnsan
shrwnsan / bkg-gradient.less.css
Last active October 11, 2015 23:38
Patterns: LessCSS Mixins & Functions
// Simple background gradient; 2-colors
.background-gradient (@start-color: #BE5B63, @end-color: #7F1C24) {
// Generated via http://j.mp/ROBdww (CSSGradientButton.com)
background-color: @start-color;
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, @start-color), color-stop(100%, @end-color));
background-image: -webkit-linear-gradient(top, @start-color, @end-color);
background-image: -moz-linear-gradient(top, @start-color, @end-color);
background-image: -ms-linear-gradient(top, @start-color, @end-color);
background-image: -o-linear-gradient(top, @start-color, @end-color);
background-image: linear-gradient(top, @start-color, @end-color);
@shrwnsan
shrwnsan / .profile
Last active October 11, 2015 23:38
Git Info — Almost Like “svn info”. Write up via http://justamemo.com/2009/02/09/git-info-almost-like-svn-info/
alias gi='. /Users/$USER/git-info.sh'
@shrwnsan
shrwnsan / GitHub Gists CSS
Created October 23, 2012 08:51 — forked from tnylea/GitHub Gists CSS
CSS to add un-selectable line numbers to your github gists
.gist .highlight {
border-left: 3ex solid #eee;
position: relative;
}
.gist .highlight pre { counter-reset: linenumbers; }
.gist .highlight pre div:before {
color: #aaa;
content: counter(linenumbers);
counter-increment: linenumbers;
left: -4ex;
@shrwnsan
shrwnsan / .bash_profile
Created November 7, 2012 16:17
My basic custom-bash files
# ~/.bash_profile: executed by bash(1) for login shells.
umask 002
PS1='\e[7m[\!] `whoami` @ \h\e[34;47;7;1m \w \e[0m
> '
alias cls="clear"
alias mytree="find . -type d | sed -e 1d -e 's/[^-][^\/]*\//--/g' -
e 's/^/
/' -e 's/-/|-/' | more"
alias ls="ls --color=auto"
@shrwnsan
shrwnsan / step1.sh
Created November 9, 2012 18:09
Convert SVN repository to Git
svn log -q | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > authors-transform.txt
@shrwnsan
shrwnsan / retina.css
Created November 30, 2012 12:35
Retina/high resolution media query
/* Clean version examples */
/* 1.25 dpr */
@media
(-webkit-min-device-pixel-ratio: 1.25),
(min-resolution: 120dpi){
/* Retina-specific stuff here */
}
/* 1.3 dpr */