Skip to content

Instantly share code, notes, and snippets.

Avatar

philipstanislaus

View GitHub Profile
@philipstanislaus
philipstanislaus / includeJQuery.js
Created Jan 29, 2016
Include jQuery in any page from console
View includeJQuery.js
var jq = document.createElement('script');
jq.src = "http://code.jquery.com/jquery-2.2.0.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
// ... give time for script to load, then type.
jQuery.noConflict();
@philipstanislaus
philipstanislaus / gist:c7de1f43b52531001412
Last active Aug 9, 2020
JavaScript: Save a blob to disc
View gist:c7de1f43b52531001412
var saveBlob = (function () {
var a = document.createElement("a");
document.body.appendChild(a);
a.style = "display: none";
return function (blob, fileName) {
var url = window.URL.createObjectURL(blob);
a.href = url;
a.download = fileName;
a.click();
window.URL.revokeObjectURL(url);
@philipstanislaus
philipstanislaus / sane-caching.nginx.conf
Last active Sep 9, 2020
Sample Nginx config with sane caching settings for modern web development
View sane-caching.nginx.conf
# Sample Nginx config with sane caching settings for modern web development
#
# Motivation:
# Modern web development often happens with developer tools open, e. g. the Chrome Dev Tools.
# These tools automatically deactivate all sorts of caching for you, so you always have a fresh
# and juicy version of your assets available.
# At some point, however, you want to show your work to testers, your boss or your client.
# After you implemented and deployed their feedback, they reload the testing page – and report
# the exact same issues as before! What happened? Of course, they did not have developer tools
# open, and of course, they did not empty their caches before navigating to your site.
@philipstanislaus
philipstanislaus / docker stop and remove all containers.sh
Last active Sep 2, 2016
Stop and remove all Docker containers
View docker stop and remove all containers.sh
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
@philipstanislaus
philipstanislaus / cloudSettings
Last active Mar 2, 2017
Visual Studio Code Sync Settings GIST
View cloudSettings
{"lastUpload":"2017-03-02T09:03:15.146Z","extensionVersion":"v2.5.1"}
@philipstanislaus
philipstanislaus / JavaScript's prototypical inheritance.js
Last active Jun 28, 2017
JavaScript inheritance (prototype, __proto__, constructor) in ES2015/ES6 and ES5
View JavaScript's prototypical inheritance.js
class Animal {
animalProp() {}
}
// ES2015/ES6
class Cat extends Animal {
catProp() {}
}
const myCat = new Cat()
@philipstanislaus
philipstanislaus / Drop all tables.sql
Created Aug 4, 2017
Drop all tables from one schema in Postgres
View Drop all tables.sql
select 'drop table if exists "' || tablename || '" cascade;'
from pg_tables
where schemaname = 'public'; -- or any other schema
View optional_values_with_nil_pointers_test.go
package playground_optional_values_with_nil_pointers
import (
"fmt"
"testing"
"github.com/ChainSafe/gossamer/codec"
)
// Bool represents boolean values
You can’t perform that action at this time.