Skip to content

Instantly share code, notes, and snippets.

@lebreRafael
lebreRafael / _document.js
Last active September 6, 2023 06:50
NextJS inline CSS files
// Code "forked" from https://stackoverflow.com/a/66430461/4788966
import Document, {
Main,
NextScript,
Head,
Html
} from 'next/document'
import {readFileSync} from "fs"
import {join} from "path"
@irustm
irustm / AngularVsReact.md
Last active April 8, 2024 09:47
Angular vs React

На случай важных переговоров

[11.01.18 18:47] [Forwarded from Алексей Охрименко]

  1. Google, Microsoft
  2. Typescript из коробки
  3. Единственный вреймворк с Dependency Injection из коробки
  4. Не нужно ничего React-ить и AngularJS-ифаить. Больше никаких оберток. jQuery плагины и D3 можно использовать на прямую
  5. Более современный фреймворк
@lhorie
lhorie / longest-keyword-sequence.md
Last active November 14, 2022 23:21
What's the longest keyword sequence in Javascript?

If you're using SystemJS in the browser, you'll want to update your System config to point at the bundles, if you're not already.

System.config({
  //use typescript for simple compilation (no typechecking)
  //transpiler: 'typescript',
  //typescript compiler options
  //typescriptOptions: {
    //emitDecoratorMetadata: true
  //},
@wh1tney
wh1tney / deploy-static-site-heroku.md
Last active April 23, 2024 17:49
How to deploy a static website to Heroku

Gist

This is a quick tutorial explaining how to get a static website hosted on Heroku.

Why do this?

Heroku hosts apps on the internet, not static websites. To get it to run your static portfolio, personal blog, etc., you need to trick Heroku into thinking your website is a PHP app. This 6-step tutorial will teach you how.

Basic Assumptions

@James1x0
James1x0 / momentjs.humanized.triplesplit.time.js
Created January 15, 2014 19:42
Get a humanized, "Morning", "Afternoon", "Evening" from moment.js **Great for user greetings!**
function getGreetingTime (m) {
var g = null; //return g
if(!m || !m.isValid()) { return; } //if we can't find a valid or filled moment, we return.
var split_afternoon = 12 //24hr time to split the afternoon
var split_evening = 17 //24hr time to split the evening
var currentHour = parseFloat(m.format("HH"));
if(currentHour >= split_afternoon && currentHour <= split_evening) {
@danbarua
danbarua / gist:5356062
Last active November 23, 2016 06:22 — forked from HasAndries/gist:3135128
AngularJs directive for Bootstrap datepicker
angular.module('bDatepicker', []).
directive('bDatepicker', function(){
return {
require: '?ngModel',
restrict: 'A',
link: function ($scope, element, attrs, controller) {
var updateModel, onblur;
if (controller != null) {
@makevoid
makevoid / img_resize.js
Created January 23, 2012 00:29
Resize Images with Canvas on the clientside
var settings = {
max_width: 600,
max_height: 200
}
resize_image = function(img){
var ctx = canvas.getContext("2d")
var canvasCopy = document.createElement("canvas")
var copyContext = canvasCopy.getContext("2d")