Skip to content

Instantly share code, notes, and snippets.

View serbanghita's full-sized avatar
🏓

Şerban Ghiţă serbanghita

🏓
View GitHub Profile
@shazron
shazron / update_all.sh
Last active September 4, 2018 07:34
Update named repos in a Github Organization
#! /bin/bash
# simple update, nothing fancy, gets things done
# run from the parent folder CWD (all repos will are siblings)
# EDIT: this is the Org for the repos
GH_ORG="adobe"
# EDIT: this is the base url for the repos (Github.com)
BASE_URL="https://github.com/$GH_ORG"
# EDIT: add the repo name to this list
@mgreer
mgreer / codeSplitting.js
Last active August 31, 2021 21:29
Code splitting HOC
// @flow
import * as React from 'react';
import {asyncComponent} from 'react-async-component';
export const loaderMaker = (bgColor: string = 'transparent') => () => (
<div style={{position: 'absolute', width: '100%', height: '100%', backgroundColor: bgColor}} />
);
const MAX_RETRIES = 3;
const STARTING_BACKOFF = 500;
const http = require('http');
const express = require('express');
const app = express();
const isDevMode = process.env.NODE_ENV === 'development';
const history = require('connect-history-api-fallback');
app.use(require('morgan')('short'));
app.use(history());
#!/bin/bash
#
# Originally found at https://github.com/mark-adams/docker-chromium-xvfb/blob/master/images/base/xvfb-chromium
# and modified to work with google-chrome instead of chromium
_kill_procs() {
kill -TERM $chrome
wait $chrome
kill -TERM $xvfb
}
@mkusher
mkusher / build.js
Last active October 14, 2019 14:50
Browserify project with tsify
var gulp = require("gulp");
var browserify = require("browserify");
var babelify = require("babelify");
var source = require("vinyl-source-stream");
var config = {
src: "index.js",
filename: "bundle.js",
dest: "./"
};
var extensions = ['.js', '.ts', '.json'];
@bogdananton
bogdananton / gist:ce128f0389ea57d2d3d3
Last active August 29, 2015 14:09
test static methods 1
<?php
class Signup
{
protected static function getSellerInstance($IdSeller = 0)
{
return '-' . $IdSeller . '-';
}
protected static function getCountryDetails($CountryName)
@mojaray2k
mojaray2k / jsbin.burut.html
Last active September 19, 2023 15:42
CSS only custom-styled select Todd Parker - Filament Group Inc. How this works: This styles a native select consistently cross-platform with only minimal CSS. The native select is then styled so it is essentially invisible (no appearance, border, bg) leaving only the select's text visible. There is a wrapper around the select that has the majori…
<html>
<head>
<title>Select styles with CSS only</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
background-color: #fff;
font-family: helvetica, sans-serif;
margin: 4% 10%
}
@candycode
candycode / image-arraybuffer.js
Created March 7, 2014 15:24
Create a jpg image from ArrayBuffer data
// Simulate a call to Dropbox or other service that can
// return an image as an ArrayBuffer.
var xhr = new XMLHttpRequest();
// Use JSFiddle logo as a sample image to avoid complicating
// this example with cross-domain issues.
xhr.open( "GET", "http://fiddle.jshell.net/img/logo.png", true );
// Ask for the result as an ArrayBuffer.
xhr.responseType = "arraybuffer";
@SunboX
SunboX / inlineworker.js
Created June 24, 2013 12:21
Create web workers without a separate worker JS files. Source: http://jsbin.com/owogib/8/
function worker() {
setInterval(function() {
postMessage({foo: "bar"});
}, 1000);
}
var code = worker.toString();
code = code.substring(code.indexOf("{")+1, code.lastIndexOf("}"));
var blob = new Blob([code], {type: "application/javascript"});
@clemblanco
clemblanco / ST_RegexSearchMultiLine
Last active May 10, 2024 15:06
Sublime Text 2 Regex Multiline Search
<head>((?!</head>).|\n)+</head>