Skip to content

Instantly share code, notes, and snippets.

View robmcalister's full-sized avatar
🐢
Slowly, but surely.

Robbie McAlister robmcalister

🐢
Slowly, but surely.
View GitHub Profile
@sturmenta
sturmenta / dashboard-example.tsx
Last active March 18, 2024 09:29
Sidebar for mobile and desktop using shadcn-ui
"use client"
import { WithSidebar } from "@/components/with-sidebar"
export const Dashboard = () => {
return (
<WithSidebar
sidebarContent={SidebarContent}
mobileDashboardHeader={CustomHeader}>
<div className="p-10">
@nepsilon
nepsilon / 3-vim-tips-with-external-commands.md
Last active December 5, 2018 17:23
3 Vim tips with external commands — First published in fullweb.io issue #95

3 Vim tips with external commands

Vim has this ! special character that will run any shell command without having to close it. Here are 3 ways I often use it:

1. Format a JSON blob:

:%!python -m json.tool

2. Count number of characters in a file:

@nepsilon
nepsilon / 5-ways-to-check-if-a-string-contains-a-substring-in-avascript.md
Last active February 28, 2017 16:15
5 ways to check if a string contains a substring in Javascript — First published in fullweb.io issue #89

5 ways to check if a string contains a substring in Javascript

1. ES6 .includes():

var S = "fullweb";
S.includes("web");

2. RegExp .search():

@robmcalister
robmcalister / RequestAnimationFrame.js
Last active January 3, 2016 09:29 — forked from mrdoob/RequestAnimationFrame.js
Request Animation Frame
/**
* Provides requestAnimationFrame in a cross browser way.
* @author paulirish / http://paulirish.com/
*/
if ( !window.requestAnimationFrame ) {
window.requestAnimationFrame = ( function() {
return window.webkitRequestAnimationFrame ||
@robmcalister
robmcalister / hold.js
Last active January 3, 2016 04:59
Tap and Hold directive for angularjs (rmHold).
app.directive('rmHold', ['$timeout', function($timeout) {
return {
restrict: 'A',
link: function(scope, elem, attrs) {
var isActive = false;
var currentTimeout = null;
var startCoords = {
x: null,
y: null
}
@alicial
alicial / mock-service-example.js
Last active June 10, 2019 14:26
AngularJS: Setting up a mocked service to use in controller unit tests.
// Mocked Service
angular.module('mock.users', []).
factory('UserService', function($q) {
var userService = {};
userService.get = function() {
return {
id: 8888,
name: "test user"
}
@jeffdonthemic
jeffdonthemic / ChatterUtils
Last active April 1, 2019 00:21
Simple Class to add Salesforce Chatter posts with links, urls and mentions.
public with sharing class ChatterUtils {
// makes a simple chatter text post to the specified user from the running user
public static void simpleTextPost(Id userId, String postText) {
ConnectApi.FeedType feedType = ConnectApi.FeedType.UserProfile;
ConnectApi.MessageBodyInput messageInput = new ConnectApi.MessageBodyInput();
messageInput.messageSegments = new List<ConnectApi.MessageSegmentInput>();
@shazron
shazron / app.js
Created May 23, 2013 22:03
RequireJS with Cordova example (app.js)
requirejs(['cordova.js'],
function () {
// start of require
// cordova is now available globally
var exec = cordova.require('cordova/exec');
var app = {
// Application Constructor
@barryvdh
barryvdh / _ide_helper.php
Last active February 29, 2024 15:18
Laravel IDE Helper for Netbeans / PhpStorm / Sublime Text 2 CodeIntel, generated using https://github.com/barryvdh/laravel-ide-helper
<?php
/**
* A helper file for Laravel 5, to provide autocomplete information to your IDE
* Generated for Laravel 5.5.13 on 2017-09-28.
*
* @author Barry vd. Heuvel <barryvdh@gmail.com>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
namespace {
exit("This file should not be included, only analyzed by your IDE");
@joshearl
joshearl / SublimeProjectExample.sublime-project
Created November 17, 2012 02:32
Sample Sublime project file with project-specific settings
{
"folders":
[
{
"path": "Leanpub/sublime-productivity",
"folder_exclude_patterns": ["epub_images", "convert_html", "preview", "published"],
"file_exclude_patterns": [".gitignore", "*.sublime*", "*Icon*"]
},
{
"path": "SublimeTextTips"