Skip to content

Instantly share code, notes, and snippets.

ig.module('plugins.component')
.requires('impact.entity')
.defines(function () {
/**
* The base class for the components. Provides the needed stubs.
* @type {Component}
*/
Component = ig.Class.extend({
@Simcamb
Simcamb / .gitattributes
Last active December 24, 2015 01:39
XCode .gitignore / .gitattributes
*.pbxproj text -crlf -diff -merge=union
@Simcamb
Simcamb / floatToHour.js
Last active May 5, 2018 21:27
Converts a float (like 1.5) to an hour (1h30)
/**
* Will convert any float (pos or neg) to an hour value
* floatToHour(1.5) will return "1h30"
*
* @param {number}
* @returns {string}
*/
function floatToHour(num) {
var sign = num >= 0 ? 1 : -1;
@Simcamb
Simcamb / euler.py
Last active December 15, 2015 11:19
from utils import *
def euler1():
res = 0
for i in range(1000):
if not (i % 3 == 0 and i % 5 == 0):
res += i
return res
@Simcamb
Simcamb / .gitignore
Last active December 13, 2015 22:39
.gitignore for Unity3D
# ---------------[ Unity generated ]------------------ #
Temp/
Obj/
UnityGenerated/
Library/
# ----[ Visual Studio / MonoDevelop generated ]------- #
ExportedObj/
*.svd
@Simcamb
Simcamb / gist:4682642
Created January 31, 2013 12:52
Prevent flickering of pageControl
- (IBAction)changePage {
// update the scroll view to the appropriate page
_pageControlBeingUsed = YES;
CGRect frame;
frame.origin.x = _scrollView.frame.size.width * _pageControl.currentPage;
frame.origin.y = 0;
frame.size = _scrollView.frame.size;
[_scrollView scrollRectToVisible:frame animated:YES];
}
@Simcamb
Simcamb / pyGitDiff.py
Created September 26, 2012 11:22
Copy different files between two git commits
#! /usr/bin/python
import subprocess
import os
import shutil
from datetime import datetime
import argparse
ignoreList = [".gitignore"]
@Simcamb
Simcamb / gist:3776272
Created September 24, 2012 14:40
Delete duplicates and keep the newest one in mySQL
DELETE mytable
FROM mytable
INNER JOIN (
SELECT max(id) AS lastId, someColumnWithDupes
FROM mytable
GROUP BY someColumnWithDupes
HAVING count(*) > 1
) duplic ON duplic.someColumnWithDupes = mytable.someColumnWithDupes
WHERE mytable.id < duplic.lastId;
@Simcamb
Simcamb / gist:3696896
Last active October 10, 2015 13:27
Find and delete duplicates in mySQL on multiple columns
--Find Duplicates
SELECT t.ID, t.id_A, t.id_B
FROM (
SELECT id_A, id_B
FROM table_name
GROUP BY id_A, id_B
HAVING count(*) > 1
) x, table_name t
WHERE x.id_A = t.id_A AND x.id_B = t.id_B