Skip to content

Instantly share code, notes, and snippets.

View xdumaine's full-sized avatar
🦄

Xander Dumaine xdumaine

🦄
View GitHub Profile
@xdumaine
xdumaine / svgexport-rn.js
Created November 19, 2019 16:47
svg export for various react-native icon sizes
const svgExport = require("svgexport");
const output = process.argv[2];
const input = process.argv[3];
const images = [
[".android.png", "36:"],
["@1.5x.android.png", "54:"],
["@2x.android.png", "72:"],
["@2x.ios.png", "72:"],
["@3x.android.png", "108:"],
["@3x.ios.png", "108:"],
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@xdumaine
xdumaine / lazyload.js
Last active November 12, 2018 17:33
Lazy
/* lazyload.js (c) Xander Dumaine
* MIT License (http://www.opensource.org/licenses/mit-license.html)
*
* Adapted from https://css-tricks.com/snippets/javascript/lazy-loading-images/
*
* expects a bunch of
* `<img src="blank.gif" data-src="my_image.png">`
*/
!function (window) {
@xdumaine
xdumaine / webrtc.svg
Last active July 3, 2017 08:59
An svg of the webrtc logo, suitable for use as icon. Created "by eye" by Xander Dumaine
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@xdumaine
xdumaine / utilities.cs
Last active December 26, 2015 10:49
utility method for resolving a ListFormWebPart on a custom page
// in code behind (null checking/exception catching omitted for clarity)
var listItemId = int.Parse(Request["ID"]);
Utilities.ResolveListFormWebPart("MyListName", listItemId, MyListFormWebPart);
// in utilities class
internal static void ResolveListFormWebPart(string listName, int listItemId, ListFormWebPart listFormWebPart)
{
using (var site = new SPSite(SPContext.Current.Web.Url))
using (var web = site.OpenWeb())
{
@xdumaine
xdumaine / server.js
Last active December 25, 2015 22:39
Added routes for server.js to support old wordpress permalinks
for(var year = 2000; year < 2050; year++) {
for(var month = 1; month < 13; month++) {
for(var day = 1; day < 32; day++) {
server.get('/' + year + '/' + (month < 10 ? '0' : '') + month + '/' + (day < 10 ? '0' : '') + day + '/:slug/', frontend.single);
}
server.get('/' + year + '/' + (month < 10 ? '0' : '') + month + '/:slug/', frontend.single);
}
server.get('/' + year + '/:slug/', frontend.single);
}
@xdumaine
xdumaine / resolveWebpartList.cs
Last active December 25, 2015 19:19
Resolve a web part by list name in SharePoint
// called from code behind
Utilities.ResolveWebPartList("MyListName", MyListWebPart);
// In a utilities class
internal static void ResolveWebPartList(string listName, XsltListViewWebPart listViewWebPart)
{
using (var site = new SPSite(SPContext.Current.Web.Url))
using (var web = site.OpenWeb())
{
@xdumaine
xdumaine / taskbar.xaml
Created October 15, 2013 15:34
xaml for progress bar and controls in a Taskbar definition for a WPF application in Windows 7.
<Window.TaskbarItemInfo>
<TaskbarItemInfo Description="My Taskbar Sample" ProgressState="Normal">
<TaskbarItemInfo.ProgressValue>
<MultiBinding Converter="{StaticResource ProgressBarConverter}">
<Binding Path="SongsUsed" Mode="OneWay" Converter="{StaticResource ListToCountConverter}"/>
<Binding Path="NumberOfSongs"/>
</MultiBinding>
</TaskbarItemInfo.ProgressValue>
<TaskbarItemInfo.ThumbButtonInfos>
<ThumbButtonInfoCollection>
@xdumaine
xdumaine / media-queries.css
Created October 15, 2013 15:19
css media queries
@media only screen and (min-device-width: 480px) { ... }
@media only screen and (min-device-width: 600px) { ... }
@media only screen and (min-width: 770px) { ... }