Skip to content

Instantly share code, notes, and snippets.

View joshthecoder's full-sized avatar

Joshua Roesslein joshthecoder

View GitHub Profile
@timurcatakli
timurcatakli / webpack.config.js
Last active May 1, 2023 18:25
An Easy to Understand Webpack 4+ Configuration File with Comments
const publicPath = 'public';
// Node os module
// The os module provides a number of operating system-related utility methods.
// It can be accessed using:
const os = require('os');
// Using a single monolithic configuration file impacts comprehension and
// removes any potential for reusability.
// As the needs of your project grow, you have to figure out the means to manage
// webpack configuration more effectively.
@skevy
skevy / gist:8a4ffc3cfdaf5fd68739
Last active February 4, 2017 04:59
Redux with reduced boilerplate

Note

I would recommend @acdlite's redux-actions over the methods suggested in this Gist.

The methods below can break hot-reloading and don't support Promise-based actions.

Even though 'redux-actions' still uses constants, I've come to terms with the fact that constants can be good, especially in bigger projects. You can reduce boilerplate in different places, as described in the redux docs here: http://gaearon.github.io/redux/docs/recipes/ReducingBoilerplate.html


@andrewliebchen
andrewliebchen / gist:d5072737063b7c7eebd6
Last active August 29, 2015 14:12
Transforming your CSS to JS for fun and profit

Quick guide to CSS in JS.

Transforming your CSS to Javascript is easy!

Step 1:

Change all css file extensions to js.

Step 2:

@creationix
creationix / jsonparse.js
Last active May 10, 2024 14:36
A streaming JSON parser as an embeddable state machine.
// A streaming byte oriented JSON parser. Feed it a single byte at a time and
// it will emit complete objects as it comes across them. Whitespace within and
// between objects is ignored. This means it can parse newline delimited JSON.
function jsonMachine(emit, next) {
next = next || $value;
return $value;
function $value(byte) {
if (!byte) return;
if (byte === 0x09 || byte === 0x0a || byte === 0x0d || byte === 0x20) {
@IlianIliev
IlianIliev / tests.py
Last active December 12, 2015 12:08
Tweeter timeline time formatter
import unittest
from datetime import datetime, timedelta
from tweetime import timelinetime
class TimeLineTimeTest(unittest.TestCase):
def test_timelinetime(self):
now = datetime.now()
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@marshall
marshall / activity1.js
Created February 22, 2011 17:24
Native Titanium + Android example code
var activity = Ti.Android.currentActivity;
var win = Ti.UI.currentWindow;
activity.addEventListener("create", function(e) {
var button = Ti.UI.createButton({title: "Hello world"});
button.addEventListener("click", function(e) {
activity.finish();
});
win.add(button);
});
@zcopley
zcopley / curl-7.21.3-SPNEGO-VC8-build-notes.txt
Created February 4, 2011 20:19
Notes on building curl 7.21.3 with Visual Studio 2005
This branch has a version of curl-7.21.3 with a new patch to do SPNEGO/GSS-API Negotiate via Windows SSPI applied to it, and modified make files for VC++ 8 (Visual Studio 2005). I've successfully built a working libcurl.dll and curl.exe with SSL and zlib using it.
https://github.com/zcopley/curl/tree/vs2005
External dependency notes
-------------------------
* SSL - I used OpenSSL 1.0.0c (Win32OpenSSL-1_0_0c.exe) from here: http://www.shininglightpro.com/products/Win32OpenSSL.html
* zLib - This one is tricky. I needed to compile this from source, because none of the precompiled DLLs floating around would work. I used v1.2.5 from here: http://zlib.net/zlib-1.2.5.tar.gz The magic incantation is to build it (from the root zLib source dir) is: