Skip to content

Instantly share code, notes, and snippets.

View divmgl's full-sized avatar

Dexter Miguel divmgl

  • San Francisco, CA
  • 11:19 (UTC -04:00)
  • X @divmgl
View GitHub Profile
@ryanbagueros
ryanbagueros / iterm2+IR-Black.itermcolors
Created March 3, 2012 19:38
iterm2 color scheme based on IR-Black
http://blog.toddwerth.com/entries/6
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<!--
iTerm2 IR-Black Colorscheme
Based on Todd Werth's IR-Black Colorscheme for Terminal.app, see:
http://blog.toddwerth.com/entries/6
by: ryan bagueros <[email protected]>
@haacked
haacked / csharp-conventions.md
Last active December 23, 2015 07:29
Examples of C# code conventions for http://sideeffect.kr/popularconvention/

Space vs Tab

Space

public string GetSomething()
{
    return something;
}
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten
@rikukissa
rikukissa / POST.md
Last active June 12, 2024 02:39
Unit testing Angular.js app with node.js, mocha, angular-mocks and jsdom #angular.js #testing
title slug createdAt language preview
Unit testing Angular.js app with node.js, mocha, angular-mocks and jsdom
unit-testing-angular-js-app-with-node
2015-07-05T18:04:33Z
en
Majority of search result about unit testing Angular.js apps is about how to do it by using test frameworks that run the tests in a real browser. Even though it's great to be able to test your code in multiple platforms, in my opinion it creates a lot of boilerplate code and makes it hard to run the tests in, for instance a CI-server.

Testing Angular.js app headlessly with node.js + mocha

Lean unit tests with minimal setup

@sephirot47
sephirot47 / UE4 C++ Set Object Type or Set Collision Channel Type .cpp
Last active July 14, 2023 12:33
UE4 C++ Set Object Type or Set Collision Channel Type
/*
Ok, so you want to change your Object Type (or collision channel) to a custom channel in runtime.
But there's a problem, it seems UE4 doesn't support this yet, but there's a workaround hehe :)
For example, imagine you create the ObjectType Building.
Now, imagine you want to change the ObjectType of all the StaticMeshComponents of the object OBJECT (from WorldStatic to Building, for example).
You can try something like this:
*/
@alanpeabody
alanpeabody / my_app.ex
Last active February 19, 2025 16:29
Websockets in Elixir with Cowboy and Plug
defmodule MyApp do
use Application
def start(_type, _args) do
import Supervisor.Spec, warn: false
children = [
Plug.Adapters.Cowboy.child_spec(:http, MyApp.Router, [], [
dispatch: dispatch
])
@ryancdotorg
ryancdotorg / frag32.py
Created August 20, 2015 16:27
A FAT32 fragmenter, because I am a horrible person.
#!/usr/bin/env python
import random
import struct
import sys
# Most of the Fat32 class was cribbed from https://gist.github.com/jonte/4577833
def ppNum(num):
return "%s (%s)" % (hex(num), num)
@paulirish
paulirish / what-forces-layout.md
Last active July 21, 2025 17:36
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@thinkdevcode
thinkdevcode / spirals.js
Created January 7, 2016 03:42
spirals, how do they work?
"use strict";
let directions = [[-1,0], [0,1], [1,0], [0,-1]];
function spiral(n) {
let matrix = [], total = n * n;
let x = 0, y = 0, val = 1;
/// initialize matrix
for (let i = 0; i < n; i++)
@leandrocp
leandrocp / elixir_with.ex
Last active April 10, 2016 05:48
Elixir With special form
case File.read("my_file.ex") do
{:ok, contents} ->
case Code.eval_string(contents) do
{res, _binding} ->
{:ok, res}
error ->
error
error -> error
error
end