Skip to content

Instantly share code, notes, and snippets.

KorkyPlunger / gist:16c540f7b622b8906c1351e44bf1bf3c
Last active October 14, 2022 13:39
Example of an easy way to generate a visual timeline in HTML from timing/profiling data using the Google charts API
View gist:16c540f7b622b8906c1351e44bf1bf3c
<!DOCTYPE html>
<script type='text/javascript' src=''></script>
<script type='text/javascript'>
google.load('visualization', '1.1', { packages: ['timeline'] });
window.onresize = createChart;
markerikson / dispatching-action-creators.js
Last active May 2, 2020 14:27
Dispatching action creators comparison
View dispatching-action-creators.js
// approach 1: define action object in the component
payload : {
item : {itemID, itemType},
newAttributes : newValue,
// approach 2: use an action creator function
markerikson / redux-thunk-examples.js
Last active September 4, 2022 11:12
Redux-Thunk examples
View redux-thunk-examples.js
// The classic AJAX call - dispatch before the request, and after it comes back
function myThunkActionCreator(someValue) {
return (dispatch, getState) => {
dispatch({type : "REQUEST_STARTED"});"/someEndpoint", {data : someValue})
response => dispatch({type : "REQUEST_SUCCEEDED", payload : response}),
error => dispatch({type : "REQUEST_FAILED", error : error})
CMCDragonkai /
Last active August 18, 2023 12:00
cURL: Selecting a custom DNS server to resolve domain names
#!/usr/bin/env bash
# this can be useful when developing against a custom DNS server, or
# for example, if you made a change to the DNS settings of a domain, and you
# know the authoritative nameserver IP address for a domain, you could use this
# to bypass the intermediate DNS cache, and apply an HTTP request using the new
# DNS settings supplied by your specified (authoritative) nameserver
curl --dns-servers <DNSIP,DNSIP>
danielmcclure / facebook-wca-standard-events.html
Last active January 14, 2024 14:54
Sample Facebook Standard Events for New Facebook WCA (Website Custom Audience) Pixel
View facebook-wca-standard-events.html
<!-- Facebook Custom Audience Pixel Code - Placed on Every Page of Site -->
fbq('init', '{{facebook pixel}}');
fbq('track', 'PageView');
vdw / gist:f3c832df8ce271a036f2
Last active January 19, 2018 10:53
Ruby hash to dotted path
View gist:f3c832df8ce271a036f2

Convert a ruby hash to dotted path

def hash_to_dotted_path(hash, path = "")
  hash.each_with_object({}) do |(k, v), ret|
    key = path + k.to_s

    if v.is_a? Hash
      ret.merge! hash_to_dotted_path(v, key.to_s + ".")
willurd /
Last active February 27, 2024 22:29
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
impressiver / raven-config.html
Last active February 27, 2024 14:27
Raven.js configuration for logging JavaScript exceptions to Sentry ( Without the added ignore options, you'll quickly find yourself swamped with unactionable exceptions due to shoddy browser plugins and 3rd party script errors.
View raven-config.html
<!-- Raven.js Config -->
<script src="{{ JS_PATH }}/lib/raven.js" type="text/javascript"></script>
<script type="text/javascript">
// Ignore list based off:
var ravenOptions = {
// Will cause a deprecation warning, but the demise of `ignoreErrors` is still under discussion.
// See:
ignoreErrors: [
// Random plugins/extensions