Skip to content

Instantly share code, notes, and snippets.

@fitsum
fitsum / app boiler
Created February 27, 2015 22:06
app boiler
APP BOILER
Entry Points
Time
check local storage (last || total visit(s)),
check server/appstorage (last || total visit(s))
check TOD
check DOW (work/school)
check MOY (season general, available activities)
@fitsum
fitsum / fullscreen toggle
Created April 21, 2015 04:18
cross-device, modified to launch on click and only cancel on drag from top instead of toggling on click
function toggleFullScreen() {
var doc = window.document;
var docEl = doc.documentElement;
var requestFullScreen = docEl.requestFullscreen || docEl.mozRequestFullScreen || docEl.webkitRequestFullScreen || docEl.msRequestFullscreen;
var cancelFullScreen = doc.exitFullscreen || doc.mozCancelFullScreen || doc.webkitExitFullscreen || doc.msExitFullscreen;
// if(!doc.fullscreenElement && !doc.mozFullScreenElement && !doc.webkitFullscreenElement && !doc.msFullscreenElement) {
requestFullScreen.call(docEl);
// }
@fitsum
fitsum / gitscripts
Last active April 26, 2024 05:11
🙏🔧 so far just the one
# more to come
#!/bin/bash
#!/bin/bash
function reba(){
#first arg is rebase branch
count=1
for branch in "$@"
do
arguments.callee.caller.toString()
@fitsum
fitsum / viewsourceinview.js
Last active April 26, 2024 05:10
view source atop the view
// add syntax hilighting
d = document.createElement('div')
d.className = "viewsorcery";
document.getElementsByTagName('body')[0].appendChild(d)
vs = document.querySelector('.viewsorcery')
vs.style = "position:absolute; top: 0";
(function() {
var a = [],
c = 0,
@anubhavshrimal
anubhavshrimal / CountryCodes.json
Last active April 26, 2024 05:10 — forked from Goles/CountryCodes.json
Country and Dial or Phone codes in JSON format
[
{
"name": "Afghanistan",
"dial_code": "+93",
"code": "AF"
},
{
"name": "Aland Islands",
"dial_code": "+358",
"code": "AX"
@fitsum
fitsum / wordcount
Created January 18, 2016 00:06
wordcounter
//needs to account for encoded blanks other than ''
var articleBodyClass = "#article-body";
arr = $(articleBodyClass).text().split(" ")
arr.forEach(function(e,i,a){if(e==""||e==" "){a.splice(i,1)}})
console.log(arr)
@fitsum
fitsum / findInArray.js
Last active April 26, 2024 05:10
find in array
f = function(needle,haystack,collect){
collection = [];
haystack.filter(function(item){
if(typeof item === "string" && item.match(needle)!== null)
collect += item;
})
return collect;
}
@fitsum
fitsum / capture-sentence.js
Last active April 26, 2024 05:09
captures sentences
f = function(selector){
var collect = [],
// exPattern = /(^"[Mr|Mrs|Ms|Dr])\.(?![net|com|org|us|info])/;
exPattern = /\.(?![net|com|org|us|info])/;
[].forEach.call(document.querySelectorAll(selector),(e,i,a)=>{collect.push(e.textContent.split(exPattern))})
return collect;
}
// make titles work
@fitsum
fitsum / gulp-server-livereload-script.js
Last active April 26, 2024 05:09
gulp boilerplate browser reload on file change
var gulp = require('gulp');
var server = require('gulp-server-livereload');
gulp.task('webserver', function() {
gulp.src('./')
.pipe(server({
livereload: {
enable: true,
port: [35728],
filter: function(fp,cb){